From 23e24d07e6462c54e50df9ba92a933ea83c70ba3 Mon Sep 17 00:00:00 2001 From: Luosh Date: Tue, 13 Jun 2023 17:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AD=98=E5=9C=A8b=E5=B8=A7?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B,rtsp=E6=92=AD=E6=94=BE=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=97=AE=E9=A2=98=20(#2550=20#2549)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在根据rtsp pts生成ntp时,由于pts可能回退,旧有逻辑不允许回退将导致ntp异常 --- src/Common/Stamp.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Common/Stamp.cpp b/src/Common/Stamp.cpp index c7b1ab3c..3cb5ee32 100644 --- a/src/Common/Stamp.cpp +++ b/src/Common/Stamp.cpp @@ -48,8 +48,9 @@ int64_t DeltaStamp::deltaStamp(int64_t stamp) { // 时间戳增量为负,说明时间戳回环了或回退了 _last_stamp = stamp; - // 时间戳回退了,强制相对时间戳加1 - return 1; + + // 如果时间戳回退不多,那么返回负值,否则返回加1 + return -ret < MAX_CTS ? ret : 1; } void Stamp::setPlayBack(bool playback) {