aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-18 16:38:12 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-11-18 17:54:15 +0100
commita289b0b91a799a3db6cb5bebb628132863d632e4 (patch)
treecc5262906f93cb09e0c0dd01892f3c0e2e8ecd81
parent842def7d78137dafff39988326031cd943bc2a19 (diff)
downloadffmpeg-a289b0b91a799a3db6cb5bebb628132863d632e4.tar.gz
avformat/mpegts: fix resync seek
The seek ended up seeking before the begin, which caused problems Fixes initial sync issues with libbluray Fixes Ticket3117 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 7d0e927a31edb5fb584c2ab17f7fd676838d6639)
-rw-r--r--libavformat/mpegts.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 5f2dfe9cb3..fe4ac35878 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1976,7 +1976,9 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size, co
/* check packet sync byte */
if ((*data)[0] != 0x47) {
/* find a new packet start */
- avio_seek(pb, -raw_packet_size, SEEK_CUR);
+ uint64_t pos = avio_tell(pb);
+ avio_seek(pb, -FFMIN(raw_packet_size, pos), SEEK_CUR);
+
if (mpegts_resync(s) < 0)
return AVERROR(EAGAIN);
else