From c45da625ae6567281dcfca0dd1da0f4393a831d5 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Wed, 3 Apr 2013 20:06:29 -0700 Subject: [PATCH] Extend samples-per-frame fix to multi audio stream out. --- src/modules/avformat/consumer_avformat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 3831e09f..2cff6376 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -1662,6 +1662,7 @@ static void *consumer_thread( void *arg ) } } #if LIBAVCODEC_VERSION_MAJOR >= 55 + audio_avframe->nb_samples = FFMAX( samples, audio_input_nb_samples ); avcodec_fill_audio_frame( audio_avframe, codec->channels, codec->sample_fmt, (const uint8_t*) audio_buf_2, AUDIO_ENCODE_BUFFER_SIZE, 0 ); int got_packet = 0; @@ -1671,6 +1672,7 @@ static void *consumer_thread( void *arg ) else if ( !got_packet ) pkt.size = 0; #else + codec->frame_size = FFMAX( samples, audio_input_nb_samples ); pkt.size = avcodec_encode_audio( codec, audio_outbuf, audio_outbuf_size, (short*) audio_buf_2 ); pkt.pts = codec->coded_frame? codec->coded_frame->pts : AV_NOPTS_VALUE; pkt.flags |= PKT_FLAG_KEY; -- 2.39.2