[FFmpeg-devel] [PATCH] [RFC] libavformat/mpegts: Prevent wrapping of PTS & DTS

Michael Niedermayer michael at niedermayer.cc
Sun Jun 12 14:23:52 CEST 2016


On Sat, Jun 11, 2016 at 06:55:32PM -0400, DeHackEd wrote:
> Presently the mpegts demuxer passes the timestamps from received packets directly to the output AVPackets. 2^33 / 90000
> seconds is about 26.5 hours at which point applications start having a fit, and that's assuming timestamps begin at time 0.
> 
> So here's a first revision of a patch to fix that issue.
> 
> Improvements possible:
> * In its current form intended for continuous sources like over-the-air receivers and multicast sources. When used on
> files there will be problems with seeking.
> * Constants such as 2^33 could be turned into macros for readability

>  mpegts.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 48 insertions(+), 8 deletions(-)
> b95c5f58685106dab1f434a3bb465ad5a0ba1636  new-pts-dts.patch
> From d06a3bd39fc4f01b9ce6132d80634dd31be7b1aa Mon Sep 17 00:00:00 2001
> From: DHE <git at dehacked.net>
> Date: Mon, 30 May 2016 18:31:43 -0400
> Subject: [PATCH] libavformat/mpegts: Prevent wrapping of PTS & DTS

this could cause issues with seeking (as the same packet could
result in different timestamps depending on luck) as well as subtitles
(which could get misidentified as wraps)
also mpeg-ps has the same kind of timestamps,
If there is an issue that would affect it too, a fix should be in
common code
iam not sure what issue there is though, it seems you expect something
from the demuxer that its not supposed to do.
mpeg-ps/ts have 33bit timestamps and they wrap, anything done to
the wraping belongs to the user applications or common code in
libavformat.

If you want to remove timestamp discontinuities in libavformat properly
or just wraps, thats more complex and will require keeping track of
where the discontinuities are so that seeking around in the virtual
continuous timeline works and is fully consistant



[...]


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160612/6a4a7131/attachment.sig>


More information about the ffmpeg-devel mailing list