From bd8a9a78e86c012efe48f81af5fca7d8098ad943 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Fri, 13 Dec 2019 15:42:12 +0800 Subject: [PATCH] =?UTF-8?q?rtp=E4=BB=A3=E7=90=86=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=88=B3=E5=9B=9E=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtp/RtpProcess.cpp | 9 ++++++--- src/Rtp/RtpProcess.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Rtp/RtpProcess.cpp b/src/Rtp/RtpProcess.cpp index d4d57847..aa9261a8 100644 --- a/src/Rtp/RtpProcess.cpp +++ b/src/Rtp/RtpProcess.cpp @@ -183,6 +183,9 @@ void RtpProcess::onPSDecode(int stream, int64_t dts, const void *data, int bytes) { + pts /= 90; + dts /= 90; + _stamps[codecid].revise(dts,pts,dts,pts,false); switch (codecid) { case STREAM_VIDEO_H264: { @@ -202,7 +205,7 @@ void RtpProcess::onPSDecode(int stream, if(_save_file_video){ fwrite((uint8_t *)data,bytes, 1, _save_file_video.get()); } - auto frame = std::make_shared((char *) data, bytes, dts / 90, pts / 90,0); + auto frame = std::make_shared((char *) data, bytes, dts, pts,0); _merger->inputFrame(frame,[this](uint32_t dts, uint32_t pts, const Buffer::Ptr &buffer) { _muxer->inputFrame(std::make_shared(buffer->data(), buffer->size(), dts, pts,4)); }); @@ -224,7 +227,7 @@ void RtpProcess::onPSDecode(int stream, if(_save_file_video){ fwrite((uint8_t *)data,bytes, 1, _save_file_video.get()); } - auto frame = std::make_shared((char *) data, bytes, dts / 90, pts / 90, 0); + auto frame = std::make_shared((char *) data, bytes, dts, pts, 0); _merger->inputFrame(frame,[this](uint32_t dts, uint32_t pts, const Buffer::Ptr &buffer) { _muxer->inputFrame(std::make_shared(buffer->data(), buffer->size(), dts, pts, 4)); }); @@ -244,7 +247,7 @@ void RtpProcess::onPSDecode(int stream, WarnL << "audio track change to AAC from codecid:" << _codecid_audio; return; } - _muxer->inputFrame(std::make_shared((char *) data, bytes, dts / 90, 7)); + _muxer->inputFrame(std::make_shared((char *) data, bytes, dts, 7)); break; } default: diff --git a/src/Rtp/RtpProcess.h b/src/Rtp/RtpProcess.h index 13ddfbeb..42f8f20a 100644 --- a/src/Rtp/RtpProcess.h +++ b/src/Rtp/RtpProcess.h @@ -33,6 +33,7 @@ #include "RtpDecoder.h" #include "PSDecoder.h" #include "Common/Device.h" +#include "Common/Stamp.h" using namespace mediakit; namespace mediakit{ @@ -72,6 +73,7 @@ private: MultiMediaSourceMuxer::Ptr _muxer; std::shared_ptr _merger; Ticker _last_rtp_time; + map _stamps; }; }//namespace mediakit