mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
pcmdec: move number of channels check to pcm_decode_init()
This commit is contained in:
parent
83efd7652e
commit
d94e29cac9
@ -213,6 +213,11 @@ static av_cold int pcm_decode_init(AVCodecContext * avctx)
|
|||||||
PCMDecode *s = avctx->priv_data;
|
PCMDecode *s = avctx->priv_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (avctx->channels <= 0 || avctx->channels > MAX_CHANNELS) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
switch(avctx->codec->id) {
|
switch(avctx->codec->id) {
|
||||||
case CODEC_ID_PCM_ALAW:
|
case CODEC_ID_PCM_ALAW:
|
||||||
for(i=0;i<256;i++)
|
for(i=0;i<256;i++)
|
||||||
@ -266,11 +271,6 @@ static int pcm_decode_frame(AVCodecContext *avctx,
|
|||||||
samples = data;
|
samples = data;
|
||||||
src = buf;
|
src = buf;
|
||||||
|
|
||||||
if(avctx->channels <= 0 || avctx->channels > MAX_CHANNELS){
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
|
sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
|
||||||
|
|
||||||
/* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
|
/* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
|
||||||
|
Loading…
Reference in New Issue
Block a user