计算dts逻辑兼容一些奇怪的rtsp流:#1031

This commit is contained in:
ziyue 2021-08-23 21:48:30 +08:00
parent 07c5341fb0
commit bb63273c73
2 changed files with 14 additions and 4 deletions

View File

@ -169,8 +169,13 @@ bool H264RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtp) {
}
void H264RtpDecoder::outputFrame(const RtpPacket::Ptr &rtp, const H264Frame::Ptr &frame) {
//rtsp没有dts那么根据pts排序算法生成dts
_dts_generator.getDts(frame->_pts, frame->_dts);
if (frame->dropAble()) {
//不参与dts生成
frame->_dts = frame->_pts;
} else {
//rtsp没有dts那么根据pts排序算法生成dts
_dts_generator.getDts(frame->_pts, frame->_dts);
}
if (frame->keyFrame() && _gop_dropped) {
_gop_dropped = false;

View File

@ -222,8 +222,13 @@ bool H265RtpDecoder::singleFrame(const RtpPacket::Ptr &rtp, const uint8_t *ptr,
}
void H265RtpDecoder::outputFrame(const RtpPacket::Ptr &rtp, const H265Frame::Ptr &frame) {
//rtsp没有dts那么根据pts排序算法生成dts
_dts_generator.getDts(frame->_pts, frame->_dts);
if (frame->dropAble()) {
//不参与dts生成
frame->_dts = frame->_pts;
} else {
//rtsp没有dts那么根据pts排序算法生成dts
_dts_generator.getDts(frame->_pts, frame->_dts);
}
if (frame->keyFrame() && _gop_dropped) {
_gop_dropped = false;