[FFmpeg-cvslog] avconv: check output stream recording time before each frame returned from filters

Anton Khirnov git at videolan.org
Mon Jun 4 23:05:11 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Jun  3 11:35:38 2012 +0200| [bb7431f4fc44553fc0a52a69b57d220d174177d4] | committer: Anton Khirnov

avconv: check output stream recording time before each frame returned from filters

There may be multiple frames returned, so with just one check we can
write more than requested to the output.

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

 avconv.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/avconv.c b/avconv.c
index c06b497..3cbdfab 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1668,7 +1668,7 @@ static int poll_filters(void)
         OutputFile    *of = output_files[ost->file_index];
         int ret = 0;
 
-        if (!ost->filter || ost->is_past_recording_time)
+        if (!ost->filter)
             continue;
 
         if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {
@@ -1677,7 +1677,7 @@ static int poll_filters(void)
             avcodec_get_frame_defaults(ost->filtered_frame);
         filtered_frame = ost->filtered_frame;
 
-        while (ret >= 0) {
+        while (ret >= 0 && !ost->is_past_recording_time) {
             if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
                 !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
                 ret = av_buffersink_read_samples(ost->filter->filter, &picref,



More information about the ffmpeg-cvslog mailing list