diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-14 02:34:01 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-14 02:49:31 +0100 |
commit | 6086a4d74d09e2df57f9b84006c877b829707d40 (patch) | |
tree | 7f9744b9bd8e66cc336b0b4990f25fdd0d6d87e2 | |
parent | d84c51904cad23ed76c38eec5080887dae7f5f27 (diff) | |
parent | 747fbe0c212b81952bb27ec7b99fa709081e2d63 (diff) | |
download | ffmpeg-6086a4d74d09e2df57f9b84006c877b829707d40.tar.gz |
Merge commit '747fbe0c212b81952bb27ec7b99fa709081e2d63' into release/1.1
* commit '747fbe0c212b81952bb27ec7b99fa709081e2d63':
roqvideodec: fix a potential infinite loop in roqvideo_decode_frame().
mp3dec: Fix VBR bit rate parsing
wmaprodec: return an error, not 0, when the input is too small.
vmdaudio: fix invalid reads when packet size is not a multiple of chunk size
h264: check for luma and chroma bit dept being equal
Prepare for 9.4 Release
Conflicts:
RELEASE
libavcodec/vmdav.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/h264.c | 6 | ||||
-rw-r--r-- | libavcodec/mpegaudio_parser.c | 6 | ||||
-rw-r--r-- | libavcodec/vmdav.c | 2 | ||||
-rw-r--r-- | libavcodec/wmaprodec.c | 7 | ||||
-rw-r--r-- | libavformat/mp3dec.c | 6 | ||||
-rw-r--r-- | tests/ref/lavf-fate/mp3 | 4 |
6 files changed, 23 insertions, 8 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 87508128c8..d992bf2da9 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2443,6 +2443,12 @@ static int h264_set_parameter_from_sps(H264Context *h) if (s->avctx->has_b_frames < 2) s->avctx->has_b_frames = !s->low_delay; + if (h->sps.bit_depth_luma != h->sps.bit_depth_chroma) { + av_log_missing_feature(s->avctx, + "Different bit depth between chroma and luma", 1); + return AVERROR_PATCHWELCOME; + } + if (s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma || h->cur_chroma_format_idc != h->sps.chroma_format_idc) { if (s->avctx->codec && diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c index 5f97d711c6..f592d5a0ae 100644 --- a/libavcodec/mpegaudio_parser.c +++ b/libavcodec/mpegaudio_parser.c @@ -30,6 +30,7 @@ typedef struct MpegAudioParseContext { int frame_size; uint32_t header; int header_count; + int no_bitrate; } MpegAudioParseContext; #define MPA_HEADER_SIZE 4 @@ -81,7 +82,10 @@ static int mpegaudio_parse(AVCodecParserContext *s1, avctx->sample_rate= sr; avctx->channels = channels; s1->duration = frame_size; - avctx->bit_rate = bit_rate; + if (s->no_bitrate || !avctx->bit_rate) { + s->no_bitrate = 1; + avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count; + } } break; } diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 6da60c14a1..9c96055b62 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -624,7 +624,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data, /* decode audio chunks */ if (audio_chunks > 0) { buf_end = buf + buf_size; - while ( buf_end - buf >= s->chunk_size) { + while (buf_end - buf >= s->chunk_size) { if (s->out_bps == 2) { decode_audio_s16(output_samples_s16, buf, s->chunk_size, avctx->channels); diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 41e07aa5f8..a1d85f4c4b 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1515,8 +1515,11 @@ static int decode_packet(AVCodecContext *avctx, void *data, s->packet_done = 0; /** sanity check for the buffer length */ - if (buf_size < avctx->block_align) - return 0; + if (buf_size < avctx->block_align) { + av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n", + buf_size, avctx->block_align); + return AVERROR_INVALIDDATA; + } s->next_packet_start = buf_size - avctx->block_align; buf_size = avctx->block_align; diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index c6d6987eaa..57e4ba33b1 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -120,6 +120,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}}; MPADecodeHeader c; int vbrtag_size = 0; + int is_cbr; v = avio_rb32(s->pb); if(ff_mpa_check_header(v) < 0) @@ -135,7 +136,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) /* Check for Xing / Info tag */ avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]); v = avio_rb32(s->pb); - if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) { + is_cbr = v == MKBETAG('I', 'n', 'f', 'o'); + if (v == MKBETAG('X', 'i', 'n', 'g') || is_cbr) { v = avio_rb32(s->pb); if(v & XING_FLAG_FRAMES) frames = avio_rb32(s->pb); @@ -180,7 +182,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) if(frames) st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate}, st->time_base); - if(size && frames) + if (size && frames && !is_cbr) st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf); return 0; diff --git a/tests/ref/lavf-fate/mp3 b/tests/ref/lavf-fate/mp3 index 91e2b48c03..361314b2ca 100644 --- a/tests/ref/lavf-fate/mp3 +++ b/tests/ref/lavf-fate/mp3 @@ -1,3 +1,3 @@ -40a4e41ae74ec8dacdf02402831a6a58 *./tests/data/lavf-fate/lavf.mp3 -97230 ./tests/data/lavf-fate/lavf.mp3 +7fcf80c2059b5c058a6cdd2e2f798b6c *./tests/data/lavf-fate/lavf.mp3 +96366 ./tests/data/lavf-fate/lavf.mp3 ./tests/data/lavf-fate/lavf.mp3 CRC=0x6c9850fe |