diff mbox series

[FFmpeg-devel,3/3] avformat/mov: remove always false condtion

Message ID tencent_323ED356079C96E0C45B8034A5807E35CF09@qq.com
State New
Headers show
Series [FFmpeg-devel,1/3] avformat/mov: skip moof and sidx before found moov | 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 fail Make fate failed

Commit Message

Zhao Zhili Dec. 24, 2021, 9:58 a.m. UTC
203b0e35 made duration unsigned.
---
 libavformat/mov.c | 11 -----------
 1 file changed, 11 deletions(-)

Comments

Steven Liu Dec. 24, 2021, 10:22 a.m. UTC | #1
> 2021年12月24日 下午5:58,Zhao Zhili <quinkblack@foxmail.com> 写道:
> 
> 203b0e35 made duration unsigned.
> ---
> libavformat/mov.c | 11 -----------
> 1 file changed, 11 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 63483740a0..636cfce400 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -3972,17 +3972,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;
> -- 
> 2.31.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> 

Yes, this is a warning when compiling the mov.o module, but not sure if the duration is unsigned can small than 0,
Because there have some way about unsigned int use way,not sure it corect or not:
Eg. unsigned int example = -1;

Thanks

Steven Liu
Gyan Doshi Dec. 24, 2021, 11:13 a.m. UTC | #2
On 2021-12-24 03:52 pm, Steven Liu wrote:
>
>> 2021年12月24日 下午5:58,Zhao Zhili <quinkblack@foxmail.com> 写道:
>>
>> 203b0e35 made duration unsigned.
>> ---
>> libavformat/mov.c | 11 -----------
>> 1 file changed, 11 deletions(-)
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 63483740a0..636cfce400 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -3972,17 +3972,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;
>> -- 
>> 2.31.1

This is due to a recent change I made to the type of stts duration.

There is a pending patch to replace this check with a check in 
mov_read_stts, so ignore the warning for now.

Thanks,
Gyan
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 63483740a0..636cfce400 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3972,17 +3972,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;