[FFmpeg-devel] [PATCH 3/5] avformat/fifo: cause immediate stream-time recovery if time went backwards

Jan Ekström jeebjp at gmail.com
Mon Dec 7 12:08:43 EET 2020


From: Jan Ekström <jan.ekstrom at 24i.com>

This way discontinuities backwards could also get handled (albeit
they generally tend to be incorrect to begin with on this layer of
avformat).

Signed-off-by: Jan Ekström <jan.ekstrom at 24i.com>
---
 libavformat/fifo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index b940d0dafe1..9fc524adbdf 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -338,7 +338,8 @@ static int fifo_thread_attempt_recovery(FifoThreadContext *ctx, FifoMessage *msg
     }
 
     if (fifo->recovery_wait_streamtime) {
-        if (ctx->last_recovery_ts == AV_NOPTS_VALUE) {
+        if (ctx->last_recovery_ts == AV_NOPTS_VALUE ||
+            pkt->pts < ctx->last_recovery_ts) {
             /* Enforce recovery immediately */
             time_since_recovery = fifo->recovery_wait_time;
         } else {
-- 
2.29.2



More information about the ffmpeg-devel mailing list