summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-01 02:08:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-01 02:36:09 +0100
commita369a6b85819890b21a87af3ce983ce533b7169b (patch)
tree838f9821dc09bd99b59ce4a2d8123d5fd6868b91 /libavcodec/mpegaudiodec.c
parent0a3a69e8d77146b53a1112c715a78e7d293883b1 (diff)
parent52afc9716849e6fb6c2420674d790d374061c663 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (29 commits) fate: add golomb-test golomb-test: K&R formatting cosmetics h264: Split h264-test off into a separate file - golomb-test.c. h264-test: cleanup: drop timer invocations, commented out code and other cruft h264-test: Remove unused DSP and AVCodec contexts and related init calls. adpcm: Add missing stdint.h #include to fix standalone header compilation. lavf: add functions for accessing the fourcc<->CodecID mapping tables. lavc: set AVCodecContext.codec in avcodec_get_context_defaults3(). lavc: make avcodec_close() work properly on unopened codecs. lavc: add avcodec_is_open(). lavf: rename AVInputFormat.value to raw_codec_id. lavf: remove the pointless value field from flv and iv8 lavc/lavf: remove unnecessary symbols from the symbol version script. lavc: reorder AVCodec fields. lavf: reorder AVInput/OutputFormat fields. mp3dec: Fix a heap-buffer-overflow adpcmenc: remove some unneeded casts adpcmenc: use int16_t and uint8_t instead of short and unsigned char. adpcmenc: fix adpcm_ms extradata allocation adpcmenc: return proper AVERROR codes instead of -1 ... Conflicts: doc/APIchanges libavcodec/Makefile libavcodec/adpcmenc.c libavcodec/avcodec.h libavcodec/h264.c libavcodec/libavcodec.v libavcodec/mpc7.c libavcodec/mpegaudiodec.c libavcodec/options.c libavformat/Makefile libavformat/avformat.h libavformat/flvdec.c libavformat/libavformat.v Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index da34d84878..19d6f0d5eb 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1380,18 +1380,17 @@ static int mp_decode_layer3(MPADecodeContext *s)
if (!s->adu_mode) {
int skip;
const uint8_t *ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3);
+ int extrasize = av_clip(get_bits_left(&s->gb) >> 3, 0, EXTRABYTES);
assert((get_bits_count(&s->gb) & 7) == 0);
/* now we get bits from the main_data_begin offset */
av_dlog(s->avctx, "seekback: %d\n", main_data_begin);
//av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size);
- if (s->gb.size_in_bits > get_bits_count(&s->gb))
- memcpy(s->last_buf + s->last_buf_size, ptr,
- FFMIN(EXTRABYTES, (s->gb.size_in_bits - get_bits_count(&s->gb))>>3));
+ memcpy(s->last_buf + s->last_buf_size, ptr, extrasize);
s->in_gb = s->gb;
init_get_bits(&s->gb, s->last_buf, s->last_buf_size*8);
#if !UNCHECKED_BITSTREAM_READER
- s->gb.size_in_bits_plus8 += EXTRABYTES * 8;
+ s->gb.size_in_bits_plus8 += extrasize * 8;
#endif
skip_bits_long(&s->gb, 8*(s->last_buf_size - main_data_begin));
}