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

Gyan Doshi gyandoshi at gmail.com
Thu Mar 15 12:01:38 EET 2018


Fixes a bug with flushing decoders during stream_loop. Note that the 
issue is also averted if we skip flushing altogether.
-------------- next part --------------
From 2d3f9b06092d1a0ac09d9b2d1b86fbf6692282e4 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi at 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 --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;
-- 
2.12.2.windows.2


More information about the ffmpeg-devel mailing list