]> git.sesse.net Git - mlt/commitdiff
Fix an infinite loop encoding a video with vorbis audio (kdenlive-1871).
authorDan Dennedy <dan@dennedy.org>
Wed, 29 Dec 2010 09:02:43 +0000 (01:02 -0800)
committerDan Dennedy <dan@dennedy.org>
Wed, 29 Dec 2010 09:02:43 +0000 (01:02 -0800)
src/modules/avformat/consumer_avformat.c

index 6e834a9816a30175cd1c518595a233539e952c31..78570a132574772495e6b31993f1d8a6977dda98 100644 (file)
@@ -1225,9 +1225,20 @@ static void *consumer_thread( void *arg )
 
                                        // Get the audio samples
                                        if ( n > 0 )
+                                       {
                                                sample_fifo_fetch( fifo, audio_buf_1, n );
+                                       }
+                                       else if ( audio_codec_id == CODEC_ID_VORBIS && terminated )
+                                       {
+                                               // This prevents an infinite loop when some versions of vorbis do not
+                                               // increment pts when encoding silence.
+                                               audio_pts = video_pts;
+                                               break;
+                                       }
                                        else
+                                       {
                                                memset( audio_buf_1, 0, AUDIO_ENCODE_BUFFER_SIZE );
+                                       }
                                        samples = n / channels;
 
                                        // For each output stream