From: Wu Zhiqiang <mymoey...@gmail.com> Calculate first_timestamp based on first packet timestamp. Some m3u8 have streams that second one has smaller timestamp in first packet of this stream. Start/seek from start time may fail due to EIO error. It should be based on start_time of AvFormatContext.
Signed-off-by: Wu Zhiqiang <mymoey...@gmail.com> --- libavformat/hls.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 069e7b06e9..125f68ca4e 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -2110,10 +2110,8 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt) pkt_ts = AV_NOPTS_VALUE; - if (c->first_timestamp == AV_NOPTS_VALUE && - pkt_ts != AV_NOPTS_VALUE) - c->first_timestamp = av_rescale_q(pkt_ts, - get_timebase(pls), AV_TIME_BASE_Q); + c->first_timestamp = s->start_time != AV_NOPTS_VALUE ? s->start_time : 0; + } if (pls->seek_timestamp == AV_NOPTS_VALUE) -- 2.15.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel