Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2015-09-30 15:53:35 +0300
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2015-10-10 02:12:08 +0300
commit7fc8458bebc65544dccc181a20af28cfe285fcd0 (patch)
tree3e8e506559f9c9ccceb39229864149c569e24737
parent9b493887d502090255af443b3224b6d7bf63ca6c (diff)
avcodec/mp3: fix skipping zeros
Commits 43bc5cf9 and c5371f77 add code for skipping initial zeros in mp3 packets. This code forgot to report to the user that data was skipped at all. Since audio codecs allow partial packet decoding, the user application has to rely on the return value. It will remove the data reported as consumed by the decoder, and feed it to the decoder again. This resulted in the mp3 frame after the zero region to be decoded over and over again, until the zero region was finally skipped by the application. Fix this by including the amount of skipped bytes to the number of consumed bytes returned by the decode call. Fixes trac ticket #4890. (cherry picked from commit cb1da9fb8d71bb611a7b0028914c97afc3f5711d)
-rw-r--r--libavcodec/mpegaudiodec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 2834ba54c9..2ada242743 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1667,9 +1667,11 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
uint32_t header;
int ret;
+ int skipped = 0;
while(buf_size && !*buf){
buf++;
buf_size--;
+ skipped++;
}
if (buf_size < HEADER_SIZE)
@@ -1724,7 +1726,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
return ret;
}
s->frame_size = 0;
- return buf_size;
+ return buf_size + skipped;
}
static void mp_flush(MPADecodeContext *ctx)