[FFmpeg-cvslog] avformat/mpegts: fix resync seek
Michael Niedermayer
git at videolan.org
Mon Nov 18 16:46:04 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Nov 18 16:38:12 2013 +0100| [7d0e927a31edb5fb584c2ab17f7fd676838d6639] | committer: Michael Niedermayer
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 at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d0e927a31edb5fb584c2ab17f7fd676838d6639
---
libavformat/mpegts.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index e73209c..59b0058 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1993,7 +1993,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
More information about the ffmpeg-cvslog
mailing list