1. 08 May, 2020 5 commits
  2. 07 May, 2020 13 commits
  3. 06 May, 2020 18 commits
    • Limin Wang's avatar
      avformat/mux: Set AV_PKT_FLAG_KEY for is_intra_only packet · 96e5e6ab
      Limin Wang authored
      The patch will make audio and subtitle packets be marked as AV_PKT_FLAG_KEY.
      
      For audio, it'll caused the audio sample to be sync sample.
      To verify ref/fate/movenc results:
      1. Get the movenc test data
      [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_old && mv *.mp4 audio_old_
      
      After applied the patch:
      [lmwang@vpn ffmpeg]$ make fate-movenc SAMPLES=../fate-suite
      [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_key && mv *.mp4 audio_key
      
      2. Get l-smash and build boxdumper
      https://github.com/l-smash/l-smash.git
      
      3. dump the box of crc change mp4 and diff -u
      [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box audio_key/non-empty-moov-no-elst.mp4  > audio_key/non-empty-moov-no-elst.log
      [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box audio_old/non-empty-moov-no-elst.mp4  > audio_old/non-empty-moov-no-elst.log
      [lmwang@vpn ffmpeg]$ diff -u audio_key/non-empty-moov-no-elst.log audio_old/non-empty-moov-no-elst.log
      -                default_sample_flags = 0x02000000
      -                    independent
      -                    sync sample
      +                default_sample_flags = 0x01010000
      +                    dependent
      +                    non-sync sample
      
      4. have checked the change of crc are caused by default_sample_flags
      non-empty-moov.mp4, non-empty-moov-elst.mp4,
      non-empty-moov-no-elst.mp4, empty-moov.mp4, delay-moov-content.mp4,
      empty-moov-second-frag.mp4, empty-moov-second-frag-discont.mp4,
      delay-moov-second-frag-discont.mp4, delay-moov-elst-second-frag.mp4
      etc
      
      5 For subtitle, it'll effect for tests/ref/fate/binsub-movtextenc and
      tests/ref/fate/sub2video, that's expecting result for the subtitle is
      marked as keyframe. Below is the checking result of binsub-movtextenc:
      
      [lmwang@vpn ffmpeg]$ ./ffmpeg -i ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov audio_key/binsub-movtextenc.mp4
      [lmwang@vpn ffmpeg]$ ./ffmpeg -i ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov audio_old/binsub-movtextenc.mp4
      [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_key/binsub-movtextenc.mp4  > audio_key/binsub-movtextenc.log
      [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_old/binsub-movtextenc.mp4  > audio_old/binsub-movtextenc.log
      [lmwang@vpn ffmpeg]$ diff -u audio_key/binsub-movtextenc.log audio_old/binsub-movtextenc.log
      .... // the key difference is the flag for sync sample
      -                flags = 0x000701
      +                flags = 0x000301
                           data-offset-present
                           sample-duration-present
                           sample-size-present
      -                    sample-flags-present
                       sample_count = 6
      -                data_offset = 188
      +                data_offset = 164
                       sample[0]
                           sample_duration = 1570000
                           sample_size = 21
      -                    sample_flags = 0x02000000
      -                        independent
      -                        sync sample
      -                        degradation_priority = 0
                       sample[1]
                           sample_duration = 510000
                           sample_size = 2
      -                    sample_flags = 0x01010000
      -                        dependent
      -                        non-sync sample
      -                        degradation_priority = 0
                       sample[2]
                           sample_duration = 1690000
                           sample_size = 9
      -                    sample_flags = 0x02000000
      -                        independent
      -                        sync sample
      -                        degradation_priority = 0
      Suggested-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      Suggested-by: 's avatarNicolas George <george@nsup.org>
      Signed-off-by: 's avatarLimin Wang <lance.lmwang@gmail.com>
      96e5e6ab
    • Linjie Fu's avatar
      74aa3321
    • Limin Wang's avatar
    • Limin Wang's avatar
      fa21df2b
    • Limin Wang's avatar
      1a944563
    • Limin Wang's avatar
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Check allocations implicit in dynamic buffers · 3a822717
      Andreas Rheinhardt authored
      Failures of the allocations that happen under the hood when using dynamic
      buffers are usually completely unchecked and the Matroska muxer is no
      exception to this.
      
      The API has its part in this, because there is no documented way to
      actually check for errors: The return value of both avio_get_dyn_buf()
      as well as avio_close_dyn_buf() is only documented as "the length of
      the byte buffer", so that using this to return errors would be an API
      break.
      
      Therefore this commit uses the only reliable way to check for errors
      with avio_get_dyn_buf(): The AVIOContext's error flag. (This is one of
      the advantages of avio_get_dyn_buf(): By not destroying the AVIOContext
      it is possible to inspect this value.) Checking whether the size or the
      pointer vanishes is not enough as it does not check for truncated output
      (the dynamic buffer API is int based and so has to truncate the buffer
      even when enough memory would be available; it's current actual limit is
      even way below INT_MAX).
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      3a822717
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Simplify writing buffer · 8370c9c2
      Andreas Rheinhardt authored
      If one already has the contents of a master elements in a buffer of
      known size, then writing a EBML master element is no different from
      writing an EBML binary element. It is overtly complicated to use
      start/end_ebml_master() as these functions first write an unkown-length
      size field of the appropriate length, then write the buffer's contents,
      followed by a seek to the length field to overwrite it with the real
      size (obtained via avio_tell() although it was already known in
      advance), followed by another seek to the previous position. Just use
      put_ebml_binary() instead.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      8370c9c2
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Avoid dynamic buffer when writing Colour · 3122dcf2
      Andreas Rheinhardt authored
      There is a good upper bound for the maximum length of the Colour master
      element; it is therefore unnecessary to use a dynamic buffer for it.
      A simple buffer on the stack is enough. This commit implements this.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      3122dcf2
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Unify writing level 1 elements preliminarily · 851283a7
      Andreas Rheinhardt authored
      The Matroska muxer updates several header elements when the output is
      seekable; if unseekable, the buffer containing the contents of the element
      is immediately freed after writing. Before this commit, there were three
      places doing exactly the same: Checking whether the output is seekable
      and calling the function that writes and frees or the function that
      just writes the EBML master. This has been unified; adding SeekHead
      entries for these elements has been unified, too.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      851283a7
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Move adding SeekEntry into end_ebml_master_crc32() · 4ed3c925
      Andreas Rheinhardt authored
      Up until now, SeekEntries were already added before
      start_ebml_master_crc32() was even called and before we were actually
      sure that we really write the element the SeekHead references: After
      all, we might also error out later; and given that the allocations
      implicit in dynamic buffers should be checked, end_ebml_master_crc32()
      will eventually have to return errors itself, so that it is the right
      place to add SeekHead entries.
      
      The earlier behaviour is of course a remnant of the time in which
      start_ebml_master_crc32() really did output something, so that the
      position before start_ebml_master_crc32() needed to be recorded.
      Erroring out later is also not as dangerous as it seems because in
      this case no SeekHead will be written (if it happened when writing
      the header, the whole muxing process would abort; if it happened
      when writing the trailer (when writing chapters not available initially),
      writing the trailer would be aborted and no SeekHead containing the
      bogus chapter entry would be written).
      
      This commit does not change the way the SeekEntries are added for those
      elements that are output preliminarily; this is so because the SeekHead
      is written before those elements are finally output and doing it
      otherwise would increase the amount of seeks.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      4ed3c925
    • Andreas Rheinhardt's avatar
      avformat/hlsenc: Improve checks for invalid stream mappings · c801ab43
      Andreas Rheinhardt authored
      The mapping of streams to the various variant streams to be created by
      the HLS muxer is roughly as follows: Space and tab separate variant
      stream group maps while the entries in each variant stream group map are
      separated by ','.
      
      The parsing process of each variant stream group proceeded as follows:
      At first the number of occurences of "a:", "v:" and "s:" in each variant
      stream group is calculated so that one can can allocate an array of
      streams with this number of entries. Then each entry is checked and the
      check for stream numbers was deficient: It did check that there is a
      number beginning after the ":", but it did not check that the number
      extends until the next "," (or until the end).
      
      This means that an invalid variant stream group like v:0_v:1 will not be
      rejected; the problem is that the variant stream in this example is
      supposed to have two streams associated with it (because it contains two
      "v:"), yet only one stream is actually associated with it (because there
      is no ',' to start a second stream specifier). This discrepancy led to
      segfaults (null pointer dereferencing) in the rest of the code (when the
      nonexistent second stream associated to the variant stream was inspected).
      
      Furthermore, this commit also removes an instance of using atoi() whose
      behaviour on a range error is undefined.
      
      Fixes ticket #8652.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      c801ab43
    • rcombs's avatar
      lavf/dashdec: support larger manifests · 29121188
      rcombs authored
      29121188
    • Steven Liu's avatar
      avformat/url: check url root node when rel include double dot and trim double dot · 648051f0
      Steven Liu authored
      fix ticket: 8625
      and add testcase into url for double dot corner case
      Signed-off-by: 's avatarSteven Liu <lq@chinaffmpeg.org>
      648051f0
    • Steven Liu's avatar
      avformat/hlsenc: resend full url of the init fragment mp4 · 666dbe7a
      Steven Liu authored
      fix ticket: 8651
      because the init fragment mp4 file name is without base url name,
      so just modify it use the full url which splice after init function.
      
      Tested-by: matclayton
      Signed-off-by: 's avatarSteven Liu <liuqi05@kuaishou.com>
      666dbe7a
    • Yaroslav Pogrebnyak's avatar
      libavformat/hlsenc: Allow usage of 'periodic-rekey' with multi-variant streams · 7f0200d0
      Yaroslav Pogrebnyak authored
      This patch adds possibility to use 'periodic-rekey' option with
      multi-variant streams to hlsenc muxer. All streams variants
      use parameters from the same key_info_file.
      
      There are 2 sets of encryption options that kind of overlaps and add
      complexity, so I tried to do the thing without changing too much code.
      
      There is a little duplication of the key_file, key_uri, iv_string, etc
      in the VariantStream since we copy it from hls to each variant stream,
      but generally all the code remains the same to minimise appearing
      of unexpected bugs. Refactoring could be done as a separate patch then as needed.
      Signed-off-by: 's avatarYaroslav Pogrebnyak <yyyaroslav@gmail.com>
      7f0200d0
    • Steven Liu's avatar
      avformat/hlsenc: compute segment duration use current pts minus last segment end pts · a7bab199
      Steven Liu authored
      segment duration is using vs duration which compute by frame per second,
      that can not fix problem of VFR video stream, so compute the duration
      when split the segment, set the segment target duration use
      current packet pts minus the prev segment end pts..
      Reported-by: 's avatarZhao Jun <barryjzhao@tencent.com>
      Reviewed-by: 's avatarZhao Jun <barryjzhao@tencent.com>
      Signed-off-by: 's avatarSteven Liu <liuqi05@kuaishou.com>
      a7bab199
    • Steven Liu's avatar
      tests/fate/hlsenc: rename fate macro define from FATE_AFILTER to FATE_HLSENC · 03b1b968
      Steven Liu authored
      and add fate-hlsenc for test all of the testcase
      Signed-off-by: 's avatarSteven Liu <lq@chinaffmpeg.org>
      03b1b968
  4. 05 May, 2020 4 commits