ffmpeg: avoid endlessly reading from one input while another is unavailable
[ffmpeg.git] / ffmpeg.c
index 051feaec953e35c4e518303ab4305036931d82a9..e6ba0f6a103b14091ee4ded77f82555ce5f22615 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;