diff options
author | Martin Storsjö <martin@martin.st> | 2012-04-21 22:48:34 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-04-23 00:02:49 +0300 |
commit | 269cb6751b3fd2163253f9a8ea0d193121858677 (patch) | |
tree | ff2d532b27f7ab960fefb1d664eaf052a6188935 /libavformat/mpegts.c | |
parent | 9b75ae05cf1554238bb103b3c3304dcba0bbc6cf (diff) | |
download | ffmpeg-streaming-269cb6751b3fd2163253f9a8ea0d193121858677.zip ffmpeg-streaming-269cb6751b3fd2163253f9a8ea0d193121858677.tar.gz |
mpegts: Try seeking back even for nonseekable protocols
The mpegts demuxer reads 5 KB at startup just for discovering
the packet size. Since the default avio buffer size is 32 KB,
the seek back to the start will in most cases be within the
avio buffer, and will in most cases succeed even if the actual
protocol isn't seekable.
This makes the demuxer startup faster/with less data when
reading data from a non-seekable input, by not skipping
the first few KB.
If it fails, don't warn if the protocol isn't seekable, making
it behave as before in the failure case.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r-- | libavformat/mpegts.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index e067927..c853e72 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1899,7 +1899,7 @@ static int mpegts_read_header(AVFormatContext *s) /* normal demux */ /* first do a scan to get all the services */ - if (pb->seekable && avio_seek(pb, pos, SEEK_SET) < 0) + if (avio_seek(pb, pos, SEEK_SET) < 0 && pb->seekable) av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n"); mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1); |