adpcm: consume remainder after consuming XA chunks

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Misty De Meo 2018-01-05 20:06:48 +11:00 committed by Michael Niedermayer
parent fba00b7465
commit 94e6b5ac39
1 changed files with 7 additions and 0 deletions

View File

@ -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: