]> git.sesse.net Git - mlt/blobdiff - src/modules/avformat/producer_avformat.c
Fix infinite loop with audio_index=all on sample provided by BCE.
[mlt] / src / modules / avformat / producer_avformat.c
index b3ecf7b95391e7cfee5d89ceb287e8ba8b5c8ee6..a1871410fcd3b7198747124b4123e8666760f5d6 100644 (file)
@@ -2071,7 +2071,11 @@ static int decode_audio( producer_avformat self, int *ignore, AVPacket pkt, int
                        if ( int_position < req_position )
                                // We are behind, so skip some
                                *ignore = 1;
-                       else if ( int_position > req_position + 2 )
+
+                       // We use nb_streams in this test because the tolerance is dependent
+                       // on the interleaving of all streams esp. when there is more than
+                       // one audio stream.
+                       else if ( int_position > req_position + context->nb_streams )
                                // We are ahead, so seek backwards some more
                                seek_audio( self, req_position, timecode - 1.0, ignore );
                }