comparison alsdec.c @ 11198:00854e4457f2 libavcodec

Fix wrong buffer allocation for MCC in ALS.
author thilo.borgmann
date Wed, 17 Feb 2010 22:53:25 +0000
parents 638415aafbda
children f1b38a8588b2
comparison
equal deleted inserted replaced
11197:87bcae769ee7 11198:00854e4457f2
1561 ctx->ltp_gain[c] = ctx->ltp_gain_buffer + c * 5; 1561 ctx->ltp_gain[c] = ctx->ltp_gain_buffer + c * 5;
1562 1562
1563 // allocate and assign channel data buffer for mcc mode 1563 // allocate and assign channel data buffer for mcc mode
1564 if (sconf->mc_coding) { 1564 if (sconf->mc_coding) {
1565 ctx->chan_data_buffer = av_malloc(sizeof(*ctx->chan_data_buffer) * 1565 ctx->chan_data_buffer = av_malloc(sizeof(*ctx->chan_data_buffer) *
1566 num_buffers); 1566 num_buffers * num_buffers);
1567 ctx->chan_data = av_malloc(sizeof(ALSChannelData) * 1567 ctx->chan_data = av_malloc(sizeof(ALSChannelData) *
1568 num_buffers); 1568 num_buffers);
1569 ctx->reverted_channels = av_malloc(sizeof(*ctx->reverted_channels) * 1569 ctx->reverted_channels = av_malloc(sizeof(*ctx->reverted_channels) *
1570 num_buffers); 1570 num_buffers);
1571 1571
1574 decode_end(avctx); 1574 decode_end(avctx);
1575 return AVERROR(ENOMEM); 1575 return AVERROR(ENOMEM);
1576 } 1576 }
1577 1577
1578 for (c = 0; c < num_buffers; c++) 1578 for (c = 0; c < num_buffers; c++)
1579 ctx->chan_data[c] = ctx->chan_data_buffer + c; 1579 ctx->chan_data[c] = ctx->chan_data_buffer + c * num_buffers;
1580 } else { 1580 } else {
1581 ctx->chan_data = NULL; 1581 ctx->chan_data = NULL;
1582 ctx->chan_data_buffer = NULL; 1582 ctx->chan_data_buffer = NULL;
1583 ctx->reverted_channels = NULL; 1583 ctx->reverted_channels = NULL;
1584 } 1584 }