diff --git a/src/Extension/CommonRtp.cpp b/src/Extension/CommonRtp.cpp index 9ba9b682..68767a6f 100644 --- a/src/Extension/CommonRtp.cpp +++ b/src/Extension/CommonRtp.cpp @@ -34,10 +34,10 @@ bool CommonRtpDecoder::inputRtp(const RtpPacket::Ptr &rtp, bool){ return false; } auto payload = rtp->getPayload(); - auto stamp = rtp->getStampMS(); + auto stamp = rtp->getStamp(); auto seq = rtp->getSeq(); - if (_frame->_dts != stamp || _frame->_buffer.size() > _max_frame_size) { + if (_last_stamp != stamp || _frame->_buffer.size() > _max_frame_size) { //时间戳发生变化或者缓存超过MAX_FRAME_SIZE,则清空上帧数据 if (!_frame->_buffer.empty()) { //有有效帧,则输出 @@ -46,7 +46,8 @@ bool CommonRtpDecoder::inputRtp(const RtpPacket::Ptr &rtp, bool){ //新的一帧数据 obtainFrame(); - _frame->_dts = stamp; + _frame->_dts = rtp->getStampMS(); + _last_stamp = stamp; _drop_flag = false; } else if (_last_seq != 0 && (uint16_t)(_last_seq + 1) != seq) { //时间戳未发生变化,但是seq却不连续,说明中间rtp丢包了,那么整帧应该废弃 diff --git a/src/Extension/CommonRtp.h b/src/Extension/CommonRtp.h index 7df29af8..6553207e 100644 --- a/src/Extension/CommonRtp.h +++ b/src/Extension/CommonRtp.h @@ -50,6 +50,7 @@ private: private: bool _drop_flag = false; uint16_t _last_seq = 0; + uint64_t _last_stamp = 0; size_t _max_frame_size; CodecId _codec; FrameImp::Ptr _frame;