1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

lavf/wavdec: skip padding byte

WAV chunks must be even aligned. This patch skip the extra padding byte
if chunk size is odd.

Fixes ticket #2417.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Matthieu Bouron
2013-04-08 18:27:11 +02:00
committed by Michael Niedermayer
parent 0678c388ba
commit 1f2ce32825

View File

@@ -74,7 +74,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
size = next_tag(pb, &tag); size = next_tag(pb, &tag);
if (tag == tag1) if (tag == tag1)
break; break;
avio_skip(pb, size); avio_skip(pb, size + (size & 1));
} }
return size; return size;
} }
@@ -354,6 +354,9 @@ static int wav_read_header(AVFormatContext *s)
break; break;
} }
/* skip padding byte */
next_tag_ofs += (next_tag_ofs < INT64_MAX && next_tag_ofs & 1);
/* seek to next tag unless we know that we'll run into EOF */ /* seek to next tag unless we know that we'll run into EOF */
if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) || if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) ||
avio_seek(pb, next_tag_ofs, SEEK_SET) < 0) { avio_seek(pb, next_tag_ofs, SEEK_SET) < 0) {