From 5313c9ee5f591c7d85f4a3323d1b8bcece07c3e5 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Wed, 3 Apr 2013 20:03:01 -0700 Subject: [PATCH] Fix regression in most recent commit d658f9b. It could trigger audio encode errors. --- src/modules/avformat/consumer_avformat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 2762762d..3831e09f 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -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; -- 2.39.5