diff --git a/src/Extension/H264Rtp.cpp b/src/Extension/H264Rtp.cpp index 73435357..a729a1a3 100644 --- a/src/Extension/H264Rtp.cpp +++ b/src/Extension/H264Rtp.cpp @@ -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; diff --git a/src/Extension/H265Rtp.cpp b/src/Extension/H265Rtp.cpp index f783c709..09247929 100644 --- a/src/Extension/H265Rtp.cpp +++ b/src/Extension/H265Rtp.cpp @@ -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;