[FFmpeg-devel] [PATCH v2] avformat/mov: add option max_stts_delta

Michael Niedermayer michael at niedermayer.cc
Mon Dec 20 20:28:49 EET 2021


On Mon, Dec 20, 2021 at 02:01:05PM +0530, Gyan Doshi wrote:
> Very high stts sample deltas may occasionally be intended but usually
> they are written in error or used to store a negative value for dts correction
> when treated as signed 32-bit integers.
> 
> This option lets the user set an upper limit, beyond which the delta is clamped to 1.
> Values greater than the limit if negative when cast to int32 are used to adjust onward dts.
> 
> Unit is the track time scale. Default is UINT_MAX - 48000*10 which
> allows upto a 10 second dts correction for 48 kHz audio streams while
> accommodating 99.9% of uint32 range.
> ---
> 
> v2 changes:
> 
> mp4-negative-stts-problem.mp4 plays in sync with the default value
> chosen.
> stts adjustment shifted to mov_read_stts so that any downstream code
> that references raw stts does not have to contend with possibly changed
> stts values.
> 
>  libavformat/isom.h |  1 +
>  libavformat/mov.c  | 64 +++++++++++++++++++++++++++-------------------
>  2 files changed, 39 insertions(+), 26 deletions(-)

Thanks for looking into this, this patch seems to add another bug though
which is the newly added loop.
Its a few million times too slow.
A sample file which takes a fraction of a second before has not finished
demuxing after an hour
ill mail you the sample privatly


[...]


> +                int32_t delta_magnitude = *((int32_t *)&sample_duration);

a plain cast should be fine with no pointers


[...]

thx

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn
-------------- 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/20211220/2097380d/attachment.sig>


More information about the ffmpeg-devel mailing list