From: Dan Dennedy Date: Fri, 6 May 2011 06:07:27 +0000 (-0700) Subject: Fix channel count for resizing decoded audio buffer when not resampling. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3b39bc3659a460ed58507e5db3e1c1d0b3b61a38;p=mlt Fix channel count for resizing decoded audio buffer when not resampling. --- diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 18551562..f686fd80 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -2120,10 +2120,12 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format ret = av_read_frame( context, &pkt ); // We only deal with audio from the selected audio index - if ( ret >= 0 && pkt.data && pkt.size > 0 && ( pkt.stream_index == self->audio_index || - ( self->audio_index == INT_MAX && context->streams[ pkt.stream_index ]->codec->codec_type == CODEC_TYPE_AUDIO ) ) ) + index = pkt.stream_index; + if ( ret >= 0 && pkt.data && pkt.size > 0 && ( index == self->audio_index || + ( self->audio_index == INT_MAX && context->streams[ index ]->codec->codec_type == CODEC_TYPE_AUDIO ) ) ) { - int channels2 = self->audio_index == INT_MAX ? self->audio_codec[pkt.stream_index]->channels : *channels; + int channels2 = ( self->audio_index == INT_MAX || !self->audio_resample[index] ) ? + self->audio_codec[index]->channels : *channels; ret = decode_audio( self, &ignore, pkt, channels2, *samples, real_timecode, fps ); } av_free_packet( &pkt );