mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-12-02 08:13:02 +08:00
H264Track不过滤SEI: #411
This commit is contained in:
parent
c612f291db
commit
c31b0cc26b
@ -228,11 +228,6 @@ private:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case H264Frame::NAL_SEI:{
|
|
||||||
//忽略SEI
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
VideoTrack::inputFrame(frame);
|
VideoTrack::inputFrame(frame);
|
||||||
break;
|
break;
|
||||||
|
@ -166,6 +166,9 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
|
|||||||
auto pcData = frame->data() + frame->prefixSize();
|
auto pcData = frame->data() + frame->prefixSize();
|
||||||
auto iLen = frame->size() - frame->prefixSize();
|
auto iLen = frame->size() - frame->prefixSize();
|
||||||
auto type = H264_TYPE(((uint8_t*)pcData)[0]);
|
auto type = H264_TYPE(((uint8_t*)pcData)[0]);
|
||||||
|
if(type == H264Frame::NAL_SEI){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_gotSpsPps) {
|
if (!_gotSpsPps) {
|
||||||
//尝试从frame中获取sps pps
|
//尝试从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()) {
|
if(_lastPacket && _lastPacket->timeStamp != frame->dts()) {
|
||||||
RtmpCodec::inputRtmp(_lastPacket, _lastPacket->isVideoKeyFrame());
|
RtmpCodec::inputRtmp(_lastPacket, _lastPacket->isVideoKeyFrame());
|
||||||
_lastPacket = nullptr;
|
_lastPacket = nullptr;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#ifdef ENABLE_MP4
|
#ifdef ENABLE_MP4
|
||||||
#include "MP4Muxer.h"
|
#include "MP4Muxer.h"
|
||||||
#include "Util/File.h"
|
#include "Util/File.h"
|
||||||
|
#include "Extension/H264.h"
|
||||||
namespace mediakit{
|
namespace mediakit{
|
||||||
|
|
||||||
MP4Muxer::MP4Muxer(const char *file) {
|
MP4Muxer::MP4Muxer(const char *file) {
|
||||||
@ -65,7 +66,12 @@ void MP4Muxer::inputFrame(const Frame::Ptr &frame) {
|
|||||||
int64_t dts_out, pts_out;
|
int64_t dts_out, pts_out;
|
||||||
|
|
||||||
switch (frame->getCodecId()) {
|
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: {
|
case CodecH265: {
|
||||||
//这里的代码逻辑是让SPS、PPS、IDR这些时间戳相同的帧打包到一起当做一个帧处理,
|
//这里的代码逻辑是让SPS、PPS、IDR这些时间戳相同的帧打包到一起当做一个帧处理,
|
||||||
if (!_frameCached.empty() && _frameCached.back()->dts() != frame->dts()) {
|
if (!_frameCached.empty() && _frameCached.back()->dts() != frame->dts()) {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#if defined(ENABLE_HLS)
|
#if defined(ENABLE_HLS)
|
||||||
#include "mpeg-ts-proto.h"
|
#include "mpeg-ts-proto.h"
|
||||||
#include "mpeg-ts.h"
|
#include "mpeg-ts.h"
|
||||||
|
#include "Extension/H264.h"
|
||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
@ -89,8 +90,13 @@ void TsMuxer::inputFrame(const Frame::Ptr &frame) {
|
|||||||
int64_t dts_out, pts_out;
|
int64_t dts_out, pts_out;
|
||||||
_is_idr_fast_packet = !_have_video;
|
_is_idr_fast_packet = !_have_video;
|
||||||
switch (frame->getCodecId()){
|
switch (frame->getCodecId()){
|
||||||
case CodecH265:
|
|
||||||
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这些时间戳相同的帧打包到一起当做一个帧处理,
|
//这里的代码逻辑是让SPS、PPS、IDR这些时间戳相同的帧打包到一起当做一个帧处理,
|
||||||
if (!_frameCached.empty() && _frameCached.back()->dts() != frame->dts()) {
|
if (!_frameCached.empty() && _frameCached.back()->dts() != frame->dts()) {
|
||||||
Frame::Ptr back = _frameCached.back();
|
Frame::Ptr back = _frameCached.back();
|
||||||
|
Loading…
Reference in New Issue
Block a user