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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((frame->configFrame() || frame->keyFrame()) && _lastPacket){
|
if(frame->configFrame() && _lastPacket &&_lastPacketHasVCL){
|
||||||
// key frame or sps pps flush frame
|
//sps pps flush frame
|
||||||
RtmpCodec::inputRtmp(_lastPacket);
|
RtmpCodec::inputRtmp(_lastPacket);
|
||||||
_lastPacket = nullptr;
|
_lastPacket = nullptr;
|
||||||
_lastPacketHasVCL = false;
|
_lastPacketHasVCL = false;
|
||||||
|
|
|
||||||
|
|
@ -169,9 +169,21 @@ void H265RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
|
||||||
return;// 防止sei aud 作为一帧
|
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);
|
RtmpCodec::inputRtmp(_lastPacket);
|
||||||
_lastPacket = nullptr;
|
_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) {
|
if(!_lastPacket) {
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ private:
|
||||||
string _pps;
|
string _pps;
|
||||||
H265Track::Ptr _track;
|
H265Track::Ptr _track;
|
||||||
RtmpPacket::Ptr _lastPacket;
|
RtmpPacket::Ptr _lastPacket;
|
||||||
|
bool _lastPacketHasVCL = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}//namespace mediakit
|
}//namespace mediakit
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue