aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-11-05 17:46:52 -0300
committerJames Almer <jamrial@gmail.com>2016-11-08 13:43:53 -0300
commit70c6a1bcf021b396c9186c4a46dd6c96cc9f59f8 (patch)
tree6fe4179e298813ac11f59c309e20d929e5340560 /libavformat/matroskadec.c
parent317be31eaf4f07b3bbeb703e8ee73d04b08a587c (diff)
downloadffmpeg-70c6a1bcf021b396c9186c4a46dd6c96cc9f59f8.tar.gz
avformat/matroskadec: fix DiscardPadding element parsing
If the value is negative then it means padding at the start of the packet instead of at the end. Based on a patch by Hendrik Leppkes. Reviewed-by: James Zern <jzern-at-google.com@ffmpeg.org> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 32f5e49f0c..d2a691bc06 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3082,10 +3082,14 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
av_free(pkt);
return AVERROR(ENOMEM);
}
- AV_WL32(side_data, 0);
- AV_WL32(side_data + 4, av_rescale_q(discard_padding,
+ discard_padding = av_rescale_q(discard_padding,
(AVRational){1, 1000000000},
- (AVRational){1, st->codecpar->sample_rate}));
+ (AVRational){1, st->codecpar->sample_rate});
+ if (discard_padding > 0) {
+ AV_WL32(side_data + 4, discard_padding);
+ } else {
+ AV_WL32(side_data, -discard_padding);
+ }
}
if (track->ms_compat)