[FFmpeg-cvslog] af_asyncts: check return value from lavr when flushing.

Anton Khirnov git at videolan.org
Fri Sep 7 13:50:45 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Sep  4 22:01:38 2012 +0200| [91a84a5247857d18b211f45129cf39b6788f0022] | committer: Anton Khirnov

af_asyncts: check return value from lavr when flushing.

Fixes an infinite loop on flush when avresample_get_delay() still
reports some samples but avresample_convert() doesn't return any data.

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

 libavfilter/af_asyncts.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
index f5d2798..0b8be8d 100644
--- a/libavfilter/af_asyncts.c
+++ b/libavfilter/af_asyncts.c
@@ -133,8 +133,13 @@ static int request_frame(AVFilterLink *link)
                                                      nb_samples);
         if (!buf)
             return AVERROR(ENOMEM);
-        avresample_convert(s->avr, (void**)buf->extended_data, buf->linesize[0],
-                           nb_samples, NULL, 0, 0);
+        ret = avresample_convert(s->avr, (void**)buf->extended_data,
+                                 buf->linesize[0], nb_samples, NULL, 0, 0);
+        if (ret <= 0) {
+            avfilter_unref_bufferp(&buf);
+            return (ret < 0) ? ret : AVERROR_EOF;
+        }
+
         buf->pts = s->pts;
         return ff_filter_samples(link, buf);
     }



More information about the ffmpeg-cvslog mailing list