Revision 08634e7b

View differences:

libavcodec/dca.c
1348 1348
        avctx->channel_layout = dca_core_channel_layout[s->amode];
1349 1349

  
1350 1350
        if (s->xch_present && (!avctx->request_channels ||
1351
                            avctx->request_channels > num_core_channels)) {
1351
                               avctx->request_channels > num_core_channels + !!s->lfe)) {
1352 1352
            avctx->channel_layout |= CH_BACK_CENTER;
1353 1353
            if (s->lfe) {
1354 1354
                avctx->channel_layout |= CH_LOW_FREQUENCY;
......
1357 1357
                s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode];
1358 1358
            }
1359 1359
        } else {
1360
            channels = num_core_channels + !!s->lfe;
1361
            s->xch_present = 0; /* disable further xch processing */
1360 1362
            if (s->lfe) {
1361 1363
                avctx->channel_layout |= CH_LOW_FREQUENCY;
1362 1364
                s->channel_order_tab = dca_channel_reorder_lfe[s->amode];
......
1364 1366
                s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];
1365 1367
        }
1366 1368

  
1367
        if (s->prim_channels > 0 &&
1368
            s->channel_order_tab[s->prim_channels - 1] < 0)
1369
        if (channels > !!s->lfe &&
1370
            s->channel_order_tab[channels - 1 - !!s->lfe] < 0)
1369 1371
            return -1;
1370 1372

  
1371 1373
        if (avctx->request_channels == 2 && s->prim_channels > 2) {
......
1384 1386
       unset. Ideally during the first probe for channels the crc should be checked
1385 1387
       and only set avctx->channels when the crc is ok. Right now the decoder could
1386 1388
       set the channels based on a broken first frame.*/
1387
    if (!avctx->channels)
1388
        avctx->channels = channels;
1389
    avctx->channels = channels;
1389 1390

  
1390 1391
    if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
1391 1392
        return -1;

Also available in: Unified diff