diff mbox series

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

Message ID 20201207100845.17520-4-jeebjp@gmail.com
State New
Headers show
Series FIFO meta muxer related improvements
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Jan Ekström Dec. 7, 2020, 10:08 a.m. UTC
From: Jan Ekström <jan.ekstrom@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@24i.com>
---
 libavformat/fifo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

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 {