do not set channels before checking request_channels
authorJustin Ruggles <justin.ruggles@gmail.com>
Sat, 5 Jan 2008 16:47:40 +0000 (16:47 +0000)
committerJustin Ruggles <justin.ruggles@gmail.com>
Sat, 5 Jan 2008 16:47:40 +0000 (16:47 +0000)
Originally committed as revision 11418 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/liba52.c

index d8065ef..f366a3f 100644 (file)
@@ -186,11 +186,12 @@ static int a52_decode_frame(AVCodecContext *avctx,
                     s->channels = ac3_channels[s->flags & 7];
                     if (s->flags & A52_LFE)
                         s->channels++;
-                        avctx->channels = s->channels;
                     if (avctx->request_channels > 0 &&
                             avctx->request_channels <= 2 &&
                             avctx->request_channels < s->channels) {
                         avctx->channels = avctx->request_channels;
+                    } else {
+                        avctx->channels = s->channels;
                     }
                     avctx->bit_rate = bit_rate;
                 }