Mercurial > libavcodec.hg
comparison dca.c @ 6577:1b90003d4d60 libavcodec
Only set channels in the stream if previously unset, fixes resampling crash on broken dca frames
author | banan |
---|---|
date | Thu, 10 Apr 2008 06:15:17 +0000 |
parents | 48759bfbd073 |
children | a4104482ceef |
comparison
equal
deleted
inserted
replaced
6576:5e7c69ebc019 | 6577:1b90003d4d60 |
---|---|
1171 if(avctx->request_channels == 2 && s->prim_channels > 2) { | 1171 if(avctx->request_channels == 2 && s->prim_channels > 2) { |
1172 channels = 2; | 1172 channels = 2; |
1173 s->output = DCA_STEREO; | 1173 s->output = DCA_STEREO; |
1174 } | 1174 } |
1175 | 1175 |
1176 avctx->channels = channels; | 1176 /* There is nothing that prevents a dts frame to change channel configuration |
1177 but FFmpeg doesn't support that so only set the channels if it is previously | |
1178 unset. Ideally during the first probe for channels the crc should be checked | |
1179 and only set avctx->channels when the crc is ok. Right now the decoder could | |
1180 set the channels based on a broken first frame.*/ | |
1181 if (!avctx->channels) | |
1182 avctx->channels = channels; | |
1183 | |
1177 if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels) | 1184 if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels) |
1178 return -1; | 1185 return -1; |
1179 *data_size = 0; | 1186 *data_size = 0; |
1180 for (i = 0; i < (s->sample_blocks / 8); i++) { | 1187 for (i = 0; i < (s->sample_blocks / 8); i++) { |
1181 dca_decode_block(s); | 1188 dca_decode_block(s); |