[FFmpeg-devel] [PATCH] avformat/mpegts: correct timestamp overflow on multiple pcr loopback

Michael Niedermayer michael at niedermayer.cc
Fri Jun 24 23:34:53 EEST 2022


Hi

On Fri, Jun 24, 2022 at 02:30:19PM +0200, Sébastien Rossi wrote:
> The issue I tried to patch is that on ts stream that last more than 26,5h
> (time between pcr loopback) we had pts and dts discontinuities. In
> wrap_timestamp function in demux.c, I've seen there's some code to correct
> timestamp overflow, but when the stream last more than 26,5h, timestamps
> are upper than pts_wrap_reference two times. So the second time we outrun
> the pts_wrap_reference we lose the timestamp correction and have some
> errors like pts < dts.
> What I tried to do is to restamp pts and dts using mpegts pcr information.
> The preserve_continuity function checks relative position between timestamp
> (dts or pts) and pcr, and handle cases when pcr have already loopback and
> timestamp not or vice versa. Then it applicates correction to the timestamp
> depending on pcr loopback count.

there can be more timestamp discontinuities than one per 26.5h
if the goal is to remove all that requires more code. Either
some scaning of the whole file or some quite smart stuff and either
way a buffer to store where the discontinuities are so they are consistantly
handled during seeking.

if the goal is to eliminate 1 wraparound only, there should be some
existing code i think that does this. IIRC see pts_wrap_behavior

the wraping behavior is applies to multiple demuxers so code
handling it really does not belong in a single demuxer


> 
> I can provide a stream with a duration of 30h, if you want to.

not needed


> 
> Could you tell me how to reproduce the segfault you've seen ?

it segfaults because filter is NULL.
i can send you the file but as the code and why its segfaults is
specific to one demxuer and this shouldnt be in one single demuxer
i dont think it would help you

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220624/4d84d441/attachment.sig>


More information about the ffmpeg-devel mailing list