X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavcodec%2Fmpegaudiodec.c;h=da34d8487887ec10f2abae7fad1dc6ab33222dc7;hb=e37f161e66e042d6c2c7470c4d9881df9427fc4a;hp=51b197081cb16d6d0b8dc0c157dfe176c837844d;hpb=feb997577b66367a0c4269100888640699ee890d;p=ffmpeg diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 51b197081cb..da34d848788 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -1385,7 +1385,9 @@ static int mp_decode_layer3(MPADecodeContext *s) 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); - memcpy(s->last_buf + s->last_buf_size, ptr, EXTRABYTES); + 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)); s->in_gb = s->gb; init_get_bits(&s->gb, s->last_buf, s->last_buf_size*8); #if !UNCHECKED_BITSTREAM_READER @@ -1725,11 +1727,6 @@ static int decode_frame_adu(AVCodecContext *avctx, void *data, s->frame_size = len; -#if FF_API_PARSE_FRAME - if (avctx->parse_only) - out_size = buf_size; - else -#endif out_size = mp_decode_frame(s, NULL, buf, buf_size); *got_frame_ptr = 1; @@ -1977,11 +1974,7 @@ AVCodec ff_mp1_decoder = { .priv_data_size = sizeof(MPADecodeContext), .init = decode_init, .decode = decode_frame, -#if FF_API_PARSE_FRAME - .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1, -#else .capabilities = CODEC_CAP_DR1, -#endif .flush = flush, .long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"), }; @@ -1994,11 +1987,7 @@ AVCodec ff_mp2_decoder = { .priv_data_size = sizeof(MPADecodeContext), .init = decode_init, .decode = decode_frame, -#if FF_API_PARSE_FRAME - .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1, -#else .capabilities = CODEC_CAP_DR1, -#endif .flush = flush, .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), }; @@ -2011,11 +2000,7 @@ AVCodec ff_mp3_decoder = { .priv_data_size = sizeof(MPADecodeContext), .init = decode_init, .decode = decode_frame, -#if FF_API_PARSE_FRAME - .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1, -#else .capabilities = CODEC_CAP_DR1, -#endif .flush = flush, .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), }; @@ -2028,11 +2013,7 @@ AVCodec ff_mp3adu_decoder = { .priv_data_size = sizeof(MPADecodeContext), .init = decode_init, .decode = decode_frame_adu, -#if FF_API_PARSE_FRAME - .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1, -#else .capabilities = CODEC_CAP_DR1, -#endif .flush = flush, .long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"), };