From 8d7bf485002a1d9358254632f13be1f392d2ba81 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Sat, 24 Apr 2010 17:36:07 +0000 Subject: add test to ensure that ffmpeg's reported audio layout agrees with channel count a crash report from a user leads me to believe ffmpeg is giving us a channel layout that has a different number of channels than the channel count it tells us. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3260 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/stream.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libhb/stream.c') diff --git a/libhb/stream.c b/libhb/stream.c index f75400f45..d2d2a4a47 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -2783,10 +2783,17 @@ static void add_ffmpeg_audio( hb_title_t *title, hb_stream_t *stream, int id ) { AVStream *st = stream->ffmpeg_ic->streams[id]; AVCodecContext *codec = st->codec; + int layout; // scan will ignore any audio without a bitrate. Since we've already // typed the audio in order to determine its codec we set up the audio // paramters here. + layout = hb_ff_layout_xlat( codec->channel_layout, codec->channels ); + if ( !layout ) + { + // Unsupported layout + return; + } if ( codec->bit_rate || codec->sample_rate ) { hb_audio_t *audio = calloc( 1, sizeof(*audio) );; @@ -2807,8 +2814,7 @@ static void add_ffmpeg_audio( hb_title_t *title, hb_stream_t *stream, int id ) audio->config.in.bitrate = codec->bit_rate? codec->bit_rate : 1; audio->config.in.samplerate = codec->sample_rate; - audio->config.in.channel_layout = - hb_ff_layout_xlat(codec->channel_layout, codec->channels); + audio->config.in.channel_layout = layout; } set_audio_description( audio, lang_for_code2( st->language ) ); -- cgit v1.2.3