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:
authorMisty De Meo <mistydemeo@gmail.com>2018-01-05 12:06:48 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2018-01-06 05:14:38 +0300
commit94e6b5ac3914c391912b717e6aba2cb40cc717b7 (patch)
treeb3ef51e97b250dee3345334459ea2077f01da299 /libavcodec/adpcm.c
parentfba00b7465b23d1c96fe01a8298afeda01a5d8eb (diff)
adpcm: consume remainder after consuming XA chunks
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index be206c55ba..cd3bbd33c2 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1115,6 +1115,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
int16_t *out1 = samples_p[1];
int samples_per_block = 28 * (3 - avctx->channels) * 4;
int sample_offset = 0;
+ int bytes_remaining;
while (bytestream2_get_bytes_left(&gb) >= 128) {
if ((ret = xa_decode(avctx, out0, out1, buf + bytestream2_tell(&gb),
&c->status[0], &c->status[1],
@@ -1123,6 +1124,12 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
bytestream2_skipu(&gb, 128);
sample_offset += samples_per_block;
}
+ /* Less than a full block of data left, e.g. when reading from
+ * 2324 byte per sector XA; the remainder is padding */
+ bytes_remaining = bytestream2_get_bytes_left(&gb);
+ if (bytes_remaining > 0) {
+ bytestream2_skip(&gb, bytes_remaining);
+ }
break;
}
case AV_CODEC_ID_ADPCM_IMA_EA_EACS: