Commit aa24729c authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  pcm_bluray: Return AVERROR_INVALIDDATA instead of -1 on header errors

Conflicts:
	libavcodec/pcm-mpeg.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 66328da7 1c6d2bb9
/* /*
* LPCM codecs for PCM formats found in MPEG streams * LPCM codecs for PCM formats found in MPEG streams
* Copyright (c) 2009 Christian Schmidt * Copyright (c) 2009, 2013 Christian Schmidt
* *
* This file is part of FFmpeg. * This file is part of FFmpeg.
* *
...@@ -72,7 +72,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx, ...@@ -72,7 +72,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
avctx->bits_per_coded_sample = bits_per_samples[header[3] >> 6]; avctx->bits_per_coded_sample = bits_per_samples[header[3] >> 6];
if (!(avctx->bits_per_coded_sample == 16 || avctx->bits_per_coded_sample == 24)) { if (!(avctx->bits_per_coded_sample == 16 || avctx->bits_per_coded_sample == 24)) {
av_log(avctx, AV_LOG_ERROR, "unsupported sample depth (%d)\n", avctx->bits_per_coded_sample); av_log(avctx, AV_LOG_ERROR, "unsupported sample depth (%d)\n", avctx->bits_per_coded_sample);
return -1; return AVERROR_INVALIDDATA;
} }
avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 : avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 :
AV_SAMPLE_FMT_S32; AV_SAMPLE_FMT_S32;
...@@ -94,7 +94,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx, ...@@ -94,7 +94,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
avctx->sample_rate = 0; avctx->sample_rate = 0;
av_log(avctx, AV_LOG_ERROR, "reserved sample rate (%d)\n", av_log(avctx, AV_LOG_ERROR, "reserved sample rate (%d)\n",
header[2] & 0x0f); header[2] & 0x0f);
return -1; return AVERROR_INVALIDDATA;
} }
/* /*
...@@ -108,7 +108,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx, ...@@ -108,7 +108,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
if (!avctx->channels) { if (!avctx->channels) {
av_log(avctx, AV_LOG_ERROR, "reserved channel configuration (%d)\n", av_log(avctx, AV_LOG_ERROR, "reserved channel configuration (%d)\n",
channel_layout); channel_layout);
return -1; return AVERROR_INVALIDDATA;
} }
avctx->bit_rate = FFALIGN(avctx->channels, 2) * avctx->sample_rate * avctx->bit_rate = FFALIGN(avctx->channels, 2) * avctx->sample_rate *
...@@ -136,11 +136,11 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data, ...@@ -136,11 +136,11 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
if (buf_size < 4) { if (buf_size < 4) {
av_log(avctx, AV_LOG_ERROR, "PCM packet too small\n"); av_log(avctx, AV_LOG_ERROR, "PCM packet too small\n");
return -1; return AVERROR_INVALIDDATA;
} }
if (pcm_bluray_parse_header(avctx, src)) if ((retval = pcm_bluray_parse_header(avctx, src)))
return -1; return retval;
src += 4; src += 4;
buf_size -= 4; buf_size -= 4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment