From 0548256c309ac1cd9db48d56b8351daf40d131a9 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 27 May 2020 11:25:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=86=99=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=B9rtp=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MediaSource.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index 6b3c4519..7d9ba2f8 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -480,8 +480,8 @@ MediaSource::Ptr MediaSource::createFromMP4(const string &schema, const string & } static bool isFlushAble_default(bool is_video, uint32_t last_stamp, uint32_t new_stamp, int cache_size) { - if (new_stamp < last_stamp) { - //时间戳回退(可能seek中) + if (new_stamp + 500 < last_stamp) { + //时间戳回退比较大(可能seek中),由于rtp中时间戳是pts,是可能存在一定程度的回退的 return true; } @@ -490,8 +490,8 @@ static bool isFlushAble_default(bool is_video, uint32_t last_stamp, uint32_t new } static bool isFlushAble_merge(bool is_video, uint32_t last_stamp, uint32_t new_stamp, int cache_size, int merge_ms) { - if (new_stamp < last_stamp) { - //时间戳回退(可能seek中) + if (new_stamp + 500 < last_stamp) { + //时间戳回退比较大(可能seek中),由于rtp中时间戳是pts,是可能存在一定程度的回退的 return true; } @@ -521,7 +521,6 @@ bool FlushPolicy::isFlushAble(bool is_video, bool is_key, uint32_t new_stamp, in } if (flush_flag) { -// DebugL << is_video << " " << _last_stamp[is_video] << " " << new_stamp; _last_stamp[is_video] = new_stamp; } return flush_flag;