mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-07 03:17:49 +08:00
rtmp packet must has vlc when flush
This commit is contained in:
parent
a28aeb2148
commit
d215502ff5
@ -182,8 +182,8 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if((frame->configFrame() || frame->keyFrame()) && _lastPacket){
|
||||
// key frame or sps pps flush frame
|
||||
if(frame->configFrame() && _lastPacket &&_lastPacketHasVCL){
|
||||
//sps pps flush frame
|
||||
RtmpCodec::inputRtmp(_lastPacket);
|
||||
_lastPacket = nullptr;
|
||||
_lastPacketHasVCL = false;
|
||||
|
||||
@ -169,9 +169,21 @@ void H265RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
|
||||
return;// 防止sei aud 作为一帧
|
||||
}
|
||||
|
||||
if (_lastPacket && (_lastPacket->time_stamp != frame->dts() || (type >=H264Frame::NAL_B_P && type<=H264Frame::NAL_IDR && (pcData[2]>>7 &0x01) !=0))) {
|
||||
if(frame->configFrame() && _lastPacket &&_lastPacketHasVCL){
|
||||
// sps pps flush frame
|
||||
RtmpCodec::inputRtmp(_lastPacket);
|
||||
_lastPacket = nullptr;
|
||||
_lastPacketHasVCL = false;
|
||||
}
|
||||
|
||||
if (_lastPacket && (_lastPacket->time_stamp != frame->dts() || (_lastPacketHasVCL &&type>=H265Frame::NAL_TRAIL_R &&type<= H265Frame::NAL_RSV_IRAP_VCL23 && (pcData[2]>>7 &0x01) !=0))) {
|
||||
RtmpCodec::inputRtmp(_lastPacket);
|
||||
_lastPacket = nullptr;
|
||||
_lastPacketHasVCL = false;
|
||||
}
|
||||
|
||||
if(type>=H265Frame::NAL_TRAIL_R &&type<= H265Frame::NAL_RSV_IRAP_VCL23){
|
||||
_lastPacketHasVCL = true;
|
||||
}
|
||||
|
||||
if(!_lastPacket) {
|
||||
|
||||
@ -84,6 +84,7 @@ private:
|
||||
string _pps;
|
||||
H265Track::Ptr _track;
|
||||
RtmpPacket::Ptr _lastPacket;
|
||||
bool _lastPacketHasVCL = false;
|
||||
};
|
||||
|
||||
}//namespace mediakit
|
||||
|
||||
Loading…
Reference in New Issue
Block a user