H264Track不过滤SEI: #411

This commit is contained in:
xiongziliang 2020-07-16 16:26:13 +08:00
parent c612f291db
commit c31b0cc26b
4 changed files with 17 additions and 11 deletions

View File

@ -228,11 +228,6 @@ private:
}
break;
case H264Frame::NAL_SEI:{
//忽略SEI
break;
}
default:
VideoTrack::inputFrame(frame);
break;

View File

@ -166,6 +166,9 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
auto pcData = frame->data() + frame->prefixSize();
auto iLen = frame->size() - frame->prefixSize();
auto type = H264_TYPE(((uint8_t*)pcData)[0]);
if(type == H264Frame::NAL_SEI){
return;
}
if (!_gotSpsPps) {
//尝试从frame中获取sps pps
@ -187,10 +190,6 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
}
}
if(type == H264Frame::NAL_SEI){
return;
}
if(_lastPacket && _lastPacket->timeStamp != frame->dts()) {
RtmpCodec::inputRtmp(_lastPacket, _lastPacket->isVideoKeyFrame());
_lastPacket = nullptr;

View File

@ -11,6 +11,7 @@
#ifdef ENABLE_MP4
#include "MP4Muxer.h"
#include "Util/File.h"
#include "Extension/H264.h"
namespace mediakit{
MP4Muxer::MP4Muxer(const char *file) {
@ -65,7 +66,12 @@ void MP4Muxer::inputFrame(const Frame::Ptr &frame) {
int64_t dts_out, pts_out;
switch (frame->getCodecId()) {
case CodecH264:
case CodecH264: {
int type = H264_TYPE(*((uint8_t *)frame->data() + frame->prefixSize()));
if(type == H264Frame::NAL_SEI){
break;
}
}
case CodecH265: {
//这里的代码逻辑是让SPS、PPS、IDR这些时间戳相同的帧打包到一起当做一个帧处理
if (!_frameCached.empty() && _frameCached.back()->dts() != frame->dts()) {

View File

@ -12,6 +12,7 @@
#if defined(ENABLE_HLS)
#include "mpeg-ts-proto.h"
#include "mpeg-ts.h"
#include "Extension/H264.h"
namespace mediakit {
@ -89,8 +90,13 @@ void TsMuxer::inputFrame(const Frame::Ptr &frame) {
int64_t dts_out, pts_out;
_is_idr_fast_packet = !_have_video;
switch (frame->getCodecId()){
case CodecH265:
case CodecH264: {
int type = H264_TYPE(*((uint8_t *)frame->data() + frame->prefixSize()));
if(type == H264Frame::NAL_SEI){
break;
}
}
case CodecH265: {
//这里的代码逻辑是让SPS、PPS、IDR这些时间戳相同的帧打包到一起当做一个帧处理
if (!_frameCached.empty() && _frameCached.back()->dts() != frame->dts()) {
Frame::Ptr back = _frameCached.back();