fix webrtc to rtmp multi slice on frame error

This commit is contained in:
xgj 2021-06-07 17:32:28 +08:00
parent d74779dc02
commit 0f3a8f4a9d

View File

@ -183,7 +183,7 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
}
}
if(_lastPacket && (_lastPacket->time_stamp != frame->dts() || type == H264Frame::NAL_B_P)) {
if(_lastPacket && (_lastPacket->time_stamp != frame->dts() || pcData[1]&0x80 != 0)) {
RtmpCodec::inputRtmp(_lastPacket);
_lastPacket = nullptr;
}
@ -214,10 +214,12 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
_lastPacket->buffer.append((char *) &size, 4);
_lastPacket->buffer.append(pcData, iLen);
_lastPacket->body_size = _lastPacket->buffer.size();
/*
if (type == H264Frame::NAL_B_P) {
RtmpCodec::inputRtmp(_lastPacket);
_lastPacket = nullptr;
}
*/
}
void H264RtmpEncoder::makeVideoConfigPkt() {