ffmpeg: avoid endlessly reading from one input while another is unavailable
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 22 Oct 2014 15:08:00 +0000 (17:08 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 22 Oct 2014 20:26:32 +0000 (22:26 +0200)
Testcase in Ticket 4051

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg.c

index 051feae..e6ba0f6 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3090,9 +3090,9 @@ static OutputStream *choose_output(void)
         OutputStream *ost = output_streams[i];
         int64_t opts = av_rescale_q(ost->st->cur_dts, ost->st->time_base,
                                     AV_TIME_BASE_Q);
-        if (!ost->unavailable && !ost->finished && opts < opts_min) {
+        if (!ost->finished && opts < opts_min) {
             opts_min = opts;
-            ost_min  = ost;
+            ost_min  = ost->unavailable ? NULL : ost;
         }
     }
     return ost_min;