Re: [FFmpeg-devel] [PATCH v2, 2/2] avformat/hls: fix start time seek error

2018-01-03 Thread wm4
On Tue,  2 Jan 2018 22:44:47 -0500
mymoey...@gmail.com wrote:

> From: Wu Zhiqiang 
> 
> 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 
> ---
>  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)

Not sure if I agree with this. AFAIK start_time is set by
avformat_find_stream_info(), so calling that would be required. But
that call also adds a lot of startup latency.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2, 2/2] avformat/hls: fix start time seek error

2018-01-02 Thread mymoeyard
From: Wu Zhiqiang 

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 
---
 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