From d8dbf434909335be49fb6228fa5390cd375227de Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 14 Jan 2020 10:25:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96dts=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/Stamp.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Common/Stamp.cpp b/src/Common/Stamp.cpp index 1c037d32..a0017752 100644 --- a/src/Common/Stamp.cpp +++ b/src/Common/Stamp.cpp @@ -128,18 +128,19 @@ bool DtsGenerator::getDts_l(uint32_t pts, uint32_t &dts){ return true; } - if(pts > _last_max_pts){ - if(!_sorter_max_size && _frames_since_last_max_pts && _count_sorter_max_size++ > 0){ - _sorter_max_size = _frames_since_last_max_pts; - _dts_pts_offset = (pts - _last_max_pts) / 2; + if(!_sorter_max_size){ + if(pts > _last_max_pts){ + if(_frames_since_last_max_pts && _count_sorter_max_size++ > 0){ + _sorter_max_size = _frames_since_last_max_pts; + _dts_pts_offset = (pts - _last_max_pts) / 2; + } + _frames_since_last_max_pts = 0; + _last_max_pts = pts; } - _frames_since_last_max_pts = 0; - _last_max_pts = pts; + ++_frames_since_last_max_pts; } _pts_sorter.emplace(pts); - ++_frames_since_last_max_pts; - if(_sorter_max_size && _pts_sorter.size() > _sorter_max_size){ auto it = _pts_sorter.begin(); dts = *it + _dts_pts_offset;