[FFmpeg-devel] [PATCH] lavf/utils.c: Don't compute start_time from DISCARD packets for video.

Sasi Inguva isasi at google.com
Wed Mar 21 22:36:18 EET 2018


Sorry, forgot to add the test reference files. Sending the revised patch.

On Wed, Mar 21, 2018 at 1:35 PM, Sasi Inguva <isasi at google.com> wrote:

> Attaching fate sample.
>
> On Wed, Mar 21, 2018 at 1:33 PM, Sasi Inguva <isasi at google.com> wrote:
>
>> Signed-off-by: Sasi Inguva <isasi at isasi.mtv.corp.google.com>
>> ---
>>  libavformat/utils.c |  4 +++-
>>  tests/fate/mov.mak  | 10 +++++++++-
>>  2 files changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index 4d0b56c2a8..f13c8208b1 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -1158,7 +1158,9 @@ static void update_initial_timestamps(AVFormatContext
>> *s, int stream_index,
>>      }
>>
>>      if (st->start_time == AV_NOPTS_VALUE) {
>> -        st->start_time = pts;
>> +        if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ||
>> !(pkt->flags & AV_PKT_FLAG_DISCARD)) {
>> +            st->start_time = pts;
>> +        }
>>          if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
>> st->codecpar->sample_rate)
>>              st->start_time += av_rescale_q(st->skip_samples,
>> (AVRational){1, st->codecpar->sample_rate}, st->time_base);
>>      }
>> diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
>> index 64f92e9488..84ca20bb9f 100644
>> --- a/tests/fate/mov.mak
>> +++ b/tests/fate/mov.mak
>> @@ -13,8 +13,10 @@ FATE_MOV = fate-mov-3elist \
>>             fate-mov-elst-ends-betn-b-and-i \
>>             fate-mov-frag-overlap \
>>             fate-mov-bbi-elst-starts-b \
>> +          fate-mov-neg-firstpts-discard-frames \
>>
>> -FATE_MOV_FFPROBE = fate-mov-aac-2048-priming \
>> +FATE_MOV_FFPROBE = fate-mov-neg-firstpts-discard \
>> +                   fate-mov-aac-2048-priming \
>>                     fate-mov-zombie \
>>                     fate-mov-init-nonkeyframe \
>>                     fate-mov-displaymatrix \
>> @@ -72,6 +74,12 @@ fate-mov-frag-overlap: CMD = framemd5 -i
>> $(TARGET_SAMPLES)/mov/frag_overlap.mp4
>>  # GOP structure : B B I in presentation order.
>>  fate-mov-bbi-elst-starts-b: CMD = framemd5 -flags +bitexact -acodec
>> aac_fixed -i $(TARGET_SAMPLES)/h264/twofields_packet.mp4
>>
>> +# Makes sure that the stream start_time is not negative when the first
>> packet is a DISCARD packet with negative timestamp.
>> +fate-mov-neg-firstpts-discard: CMD = run ffprobe$(PROGSSUF)$(EXESUF)
>> -show_entries stream=start_time -bitexact $(TARGET_SAMPLES)/mov/mov_neg_
>> first_pts_discard.mov
>> +
>> +# Makes sure that expected frames are generated for
>> mov_neg_first_pts_discard.mov with -vsync 1
>> +fate-mov-neg-firstpts-discard-frames: CMD = framemd5 -flags +bitexact
>> -i $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard.mov -vsync 1
>> +
>>  fate-mov-aac-2048-priming: CMD = run ffprobe$(PROGSSUF)$(EXESUF)
>> -show_packets -print_format compact $(TARGET_SAMPLES)/mov/aac-2048
>> -priming.mov
>>
>>  fate-mov-zombie: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_streams
>> -show_packets -show_frames -bitexact -print_format compact
>> $(TARGET_SAMPLES)/mov/white_zombie_scrunch-part.mov
>> --
>> 2.17.0.rc0.231.g781580f067-goog
>>
>>
>


More information about the ffmpeg-devel mailing list