]> git.sesse.net Git - mlt/commitdiff
Fix regression in most recent commit d658f9b.
authorDan Dennedy <dan@dennedy.org>
Thu, 4 Apr 2013 03:03:01 +0000 (20:03 -0700)
committerDan Dennedy <dan@dennedy.org>
Thu, 4 Apr 2013 03:03:01 +0000 (20:03 -0700)
It could trigger audio encode errors.

src/modules/avformat/consumer_avformat.c

index 2762762df2a479a943f76041870555871f0e2dea..3831e09f860701e5b6439e719c13d110b304d6a8 100644 (file)
@@ -1575,7 +1575,7 @@ static void *consumer_thread( void *arg )
                                                                p = interleaved_to_planar( samples, channels, p, sizeof( uint8_t ) );
 #endif
 #if LIBAVCODEC_VERSION_MAJOR >= 55
-                                                       audio_avframe->nb_samples = samples;
+                                                       audio_avframe->nb_samples = FFMAX( samples, audio_input_nb_samples );
                                                        avcodec_fill_audio_frame( audio_avframe, codec->channels, codec->sample_fmt,
                                                                (const uint8_t*) p, AUDIO_ENCODE_BUFFER_SIZE, 0 );
                                                        int got_packet = 0;
@@ -1585,7 +1585,7 @@ static void *consumer_thread( void *arg )
                                                        else if ( !got_packet )
                                                                pkt.size = 0;
 #else
-                                                       codec->frame_size = samples;
+                                                       codec->frame_size = FFMAX( samples, audio_input_nb_samples );
                                                        pkt.size = avcodec_encode_audio( codec, audio_outbuf, audio_outbuf_size, p );
                                                        pkt.pts = codec->coded_frame? codec->coded_frame->pts : AV_NOPTS_VALUE;
                                                        pkt.flags |= PKT_FLAG_KEY;