diff mbox

[FFmpeg-devel] ffmpeg.c - drain all decoded frames during stream_loop flush

Message ID 31c527c8-a202-663a-744f-53e7f36e1046@gmail.com
State Superseded
Headers show

Commit Message

Gyan March 15, 2018, 10:01 a.m. UTC
Fixes a bug with flushing decoders during stream_loop. Note that the 
issue is also averted if we skip flushing altogether.
From 2d3f9b06092d1a0ac09d9b2d1b86fbf6692282e4 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi@gmail.com>
Date: Thu, 15 Mar 2018 15:01:53 +0530
Subject: [PATCH] ffmpeg.c - drain all decoded frames during stream_loop flush

When a decoded stream is being looped, after each post-EOF rewind, decoders
are flushed in seek_to_start(). This only drains 1 frame, and thus the output has a few
frames missing at the tail of each iteration except the last.

With patch, when process_input_packet is called with no_eof=1, decoding
is looped till EOF is returned.

Fixes #7081
---
 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index ee7258fcd1..503af6b483 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2694,7 +2694,7 @@  static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
         // Decode only 1 frame per call on EOF to appease these FATE tests.
         // The ideal solution would be to rewrite decoding to use the new
         // decoding API in a better way.
-        if (!pkt)
+        if (!pkt && !no_eof)
             break;
 
         repeating = 1;