diff mbox series

[FFmpeg-devel,8/9] lavf/mov: drop a never-executed block

Message ID 20211125150500.25040-8-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,1/9] lavd/jack: increase buffer size for snprintf() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Anton Khirnov Nov. 25, 2021, 3:04 p.m. UTC
MOVStts.duration is unsigned since 203b0e3561d.
---
 libavformat/mov.c | 10 ----------
 1 file changed, 10 deletions(-)

Comments

Gyan Doshi Nov. 25, 2021, 3:52 p.m. UTC | #1
On 2021-11-25 08:34 pm, Anton Khirnov wrote:
> MOVStts.duration is unsigned since 203b0e3561d.
> ---
>   libavformat/mov.c | 10 ----------
>   1 file changed, 10 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 451cb78bbf..e85eeb0a0e 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -3965,16 +3965,6 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
>                   current_offset += sample_size;
>                   stream_size += sample_size;
>   
> -                /* A negative sample duration is invalid based on the spec,
> -                 * but some samples need it to correct the DTS. */
> -                if (sc->stts_data[stts_index].duration < 0) {
> -                    av_log(mov->fc, AV_LOG_WARNING,
> -                           "Invalid SampleDelta %d in STTS, at %d st:%d\n",
> -                           sc->stts_data[stts_index].duration, stts_index,
> -                           st->index);
> -                    dts_correction += sc->stts_data[stts_index].duration - 1;
> -                    sc->stts_data[stts_index].duration = 1;
> -                }
>                   current_dts += sc->stts_data[stts_index].duration;
>                   if (!dts_correction || current_dts + dts_correction > last_dts) {
>                       current_dts += dts_correction;

See 
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20211123131106.8652-1-ffmpeg@gyani.pro/

Although stts duration should be and is now unsigned, some writers treat 
it as signed and use negative values for DTS correction.

Michael is reviewing my patch and is offering critiques + suggestions.

Regards,
Gyan
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 451cb78bbf..e85eeb0a0e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3965,16 +3965,6 @@  static void mov_build_index(MOVContext *mov, AVStream *st)
                 current_offset += sample_size;
                 stream_size += sample_size;
 
-                /* A negative sample duration is invalid based on the spec,
-                 * but some samples need it to correct the DTS. */
-                if (sc->stts_data[stts_index].duration < 0) {
-                    av_log(mov->fc, AV_LOG_WARNING,
-                           "Invalid SampleDelta %d in STTS, at %d st:%d\n",
-                           sc->stts_data[stts_index].duration, stts_index,
-                           st->index);
-                    dts_correction += sc->stts_data[stts_index].duration - 1;
-                    sc->stts_data[stts_index].duration = 1;
-                }
                 current_dts += sc->stts_data[stts_index].duration;
                 if (!dts_correction || current_dts + dts_correction > last_dts) {
                     current_dts += dts_correction;