[FFmpeg-cvslog] avconv: send EOF to lavfi even if flushing the decoder fails

Anton Khirnov git at videolan.org
Thu Aug 9 15:42:10 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Aug  8 12:27:50 2012 +0200| [f154ef1ae5b03f288dd8c025dab1884b4cb20c1a] | committer: Anton Khirnov

avconv: send EOF to lavfi even if flushing the decoder fails

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f154ef1ae5b03f288dd8c025dab1884b4cb20c1a
---

 avconv.c |   22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/avconv.c b/avconv.c
index b786d8d..d46c8e0 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1069,15 +1069,11 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
     decoded_frame = ist->decoded_frame;
 
     ret = avcodec_decode_audio4(avctx, decoded_frame, got_output, pkt);
-    if (ret < 0) {
-        return ret;
-    }
-
-    if (!*got_output) {
-        /* no audio frame */
-        if (!pkt->size)
+    if (!*got_output || ret < 0) {
+        if (!pkt->size) {
             for (i = 0; i < ist->nb_filters; i++)
                 av_buffersrc_buffer(ist->filters[i]->filter, NULL);
+        }
         return ret;
     }
 
@@ -1216,17 +1212,15 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
 
     ret = avcodec_decode_video2(ist->st->codec,
                                 decoded_frame, got_output, pkt);
-    if (ret < 0)
-        return ret;
-
-    quality = same_quant ? decoded_frame->quality : 0;
-    if (!*got_output) {
-        /* no picture yet */
-        if (!pkt->size)
+    if (!*got_output || ret < 0) {
+        if (!pkt->size) {
             for (i = 0; i < ist->nb_filters; i++)
                 av_buffersrc_buffer(ist->filters[i]->filter, NULL);
+        }
         return ret;
     }
+
+    quality = same_quant ? decoded_frame->quality : 0;
     decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pkt_pts,
                                            decoded_frame->pkt_dts);
     pkt->size = 0;



More information about the ffmpeg-cvslog mailing list