ps rtp推流优化音视频时间戳同步问题

This commit is contained in:
xiongziliang 2020-05-15 18:21:28 +08:00
parent 1970f6014e
commit cded823b65
2 changed files with 1 additions and 6 deletions

View File

@ -233,11 +233,10 @@ static const char *getCodecName(int codec_id) {
void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t dts,const void *data,int bytes) { void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t dts,const void *data,int bytes) {
pts /= 90; pts /= 90;
dts /= 90; dts /= 90;
_stamps[codecid].revise(dts,pts,dts,pts,false); _dts = dts;
switch (codecid) { switch (codecid) {
case PSI_STREAM_H264: { case PSI_STREAM_H264: {
_dts = dts;
if (!_codecid_video) { if (!_codecid_video) {
//获取到视频 //获取到视频
_codecid_video = codecid; _codecid_video = codecid;
@ -262,7 +261,6 @@ void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
} }
case PSI_STREAM_H265: { case PSI_STREAM_H265: {
_dts = dts;
if (!_codecid_video) { if (!_codecid_video) {
//获取到视频 //获取到视频
_codecid_video = codecid; _codecid_video = codecid;
@ -285,7 +283,6 @@ void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
} }
case PSI_STREAM_AAC: { case PSI_STREAM_AAC: {
_dts = dts;
if (!_codecid_audio) { if (!_codecid_audio) {
//获取到音频 //获取到音频
_codecid_audio = codecid; _codecid_audio = codecid;
@ -304,7 +301,6 @@ void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
case PSI_STREAM_AUDIO_G711A: case PSI_STREAM_AUDIO_G711A:
case PSI_STREAM_AUDIO_G711U: { case PSI_STREAM_AUDIO_G711U: {
_dts = dts;
auto codec = codecid == PSI_STREAM_AUDIO_G711A ? CodecG711A : CodecG711U; auto codec = codecid == PSI_STREAM_AUDIO_G711A ? CodecG711A : CodecG711U;
if (!_codecid_audio) { if (!_codecid_audio) {
//获取到音频 //获取到音频

View File

@ -62,7 +62,6 @@ private:
MultiMediaSourceMuxer::Ptr _muxer; MultiMediaSourceMuxer::Ptr _muxer;
std::shared_ptr<FrameMerger> _merger; std::shared_ptr<FrameMerger> _merger;
Ticker _last_rtp_time; Ticker _last_rtp_time;
unordered_map<int,Stamp> _stamps;
uint32_t _dts = 0; uint32_t _dts = 0;
Decoder::Ptr _decoder; Decoder::Ptr _decoder;
std::weak_ptr<MediaSourceEvent> _listener; std::weak_ptr<MediaSourceEvent> _listener;