[vlc-devel] [PATCH 2/3] demux: avformat: fix negative PTS/DTS

Rémi Denis-Courmont remi at remlab.net
Thu Aug 31 12:44:20 CEST 2017


Le 31 août 2017 12:24:03 GMT+02:00, Zhao Zhili <quinkblack at foxmail.com> a écrit :
>
>
>On 2017年08月31日 17:58, Francois Cartegnie wrote:
>> Le 31/08/2017 à 08:48, Zhao Zhili a écrit :
>>> ---
>>>   modules/demux/avformat/demux.c | 41
>>> +++++++++++++++++++++++++++++------------
>>>   1 file changed, 29 insertions(+), 12 deletions(-)
>>>
>> If the timestamps are negative from the start, I don't see
>> why the issue should be on the API user side.
>>
>> But, this seems the same as last February discussion around
>> "mux/avformat: normalize pts and dts in AVPacket"
>> which had regressions.
>>
>> https://trac.videolan.org/vlc/ticket/17988
>>
>
>I'm trying to fix a case like this:
>
>original_start_time = 1000 * 1000 us;
>original_pts = 1000 * 1000 us;
>original_dts = 960 * 1000 us;
>
>new_pts = original_pts - original_start_time + VLC_TS_0 = 1 us;
>new_dts = original_dts - original_start_time + VLC_TS_0 = -39999 us;
>
>So it's the difference between PTS and DTS lead to the issue.
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

Negative timestamps can occur in some legal corner cases. There are no systematic ways to avoid them. You really shouldn't even try.

Just make sure than 0 is not a special value. There is VLC_TS_INVALID for that.
-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.


More information about the vlc-devel mailing list