1. 03 Apr, 2020 4 commits
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Improve checks for updating Tags · af97a3a4
      Andreas Rheinhardt authored
      When updating the Tags at the end, the Matroska muxer would twice check
      for whether (!mkv->is_live) is true, despite this code being only executed
      if it is. Furthermore, a loop iterates over all the streams even when
      there is no Tags element to update at all, because the check for whether
      there are Tags is only performed later. This commit fixes this.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      af97a3a4
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Remove unnecessary avio_tell(), avio_seek() · 0fc150f0
      Andreas Rheinhardt authored
      avio_close_dyn_buf() has a bug: When the write pointer does not point to
      the end of the written data when calling it (i.e. when one has performed
      a seek back to update already written data), it would not add padding to
      the end of the buffer, but to the current position, overwriting other
      data; furthermore the reported size would be wrong (off by the amount of
      data it has overwritten with padding).
      
      In order not to run into this when updating already written elements or
      elements for which size has only been reserved, the Matroska muxer would
      first record the current position of the dynamic buffer, then seek to
      the desired position, perform the update and seek back to the earlier
      position.
      
      But now that end_ebml_master_crc32() does not make use of
      avio_close_dyn_buf() any more, this is no longer necessary.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      0fc150f0
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Stop reallocating of Cluster buffer · 4aa0665f
      Andreas Rheinhardt authored
      The Matroska muxer uses a dynamic buffer to buffer the content of
      Clusters before eventually writing them. Up until now, each time a
      Cluster was written, the dynamic buffer was closed, i.e. freed; now it
      is only reset, saving allocations of the AVIOContext itself, its opaque
      as well as most of the reallocations of the buffer.
      
      This is advantageous performance-wise, in particular on systems where
      reallocations are slow (namely Windows). The following table shows the
      decicyles for writing a frame on Linux (Ubuntu 19.10) and Windows (7)
      on an x64 Haswell (to /dev/null on Linux, to stdout which is discarded
      on Windows (the default values of the size and duration of clusters for
      seekable output have been explicitly set in this case); in all tests,
      writing CRC-32 values has been disabled in all tests; calls to the muxer's
      write_packet function in write_packet() in libavformat/mux.c have been
      timed; each of the following tests has been repeated 50 times):
      
          | Windows before | Windows after | Linux before | Linux after
      _________________________________________________________________
       A  |     979437     |    192304     |    259500    |   183320
       B  |     715936     |    155648     |    152786    |   130879
       C  |     265115     |     56034     |     78496    |    53243
       D  |     386224     |     80307     |    128894    |    75354
       E  |      21732     |     10695     |     11320    |     9801
      
      (A is a 10.2 mb/s file with a GOP length of 2s, amounting to an average
      Cluster size of about 2.5 MiB; the average Cluster size of B is 1.1 MiB;
      for C it is 2.35 MiB, for D it is 0.46 MiB; for E - a file with just a
      single audio track of 158kb/s resulting in a Cluster size of about 100
      kB, the relative gains were the smallest, probably because of the small
      Cluster size.)
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      4aa0665f
    • Guo, Yejun's avatar
      configure: fix build issue of vf_dnn_processing.c when --disable-swscale · e1488700
      Guo, Yejun authored
      vf_dnn_processing.c recently changed to use swscale to trasfer data
      between AVFrame and dnn model.
      Signed-off-by: 's avatarGuo, Yejun <yejun.guo@intel.com>
      Signed-off-by: 's avatarLinjie Fu <linjie.fu@intel.com>
      e1488700
  2. 02 Apr, 2020 18 commits
  3. 01 Apr, 2020 9 commits
  4. 31 Mar, 2020 3 commits
  5. 30 Mar, 2020 6 commits
    • Carl Eugen Hoyos's avatar
      ffmpeg: Print an error instead of a debug message on exit. · b5a8ad56
      Carl Eugen Hoyos authored
      Reported-by: Forum user NewPlaza
      b5a8ad56
    • Andreas Rheinhardt's avatar
      avformat/mxfdec: Correct confusing struct tag · 8d019dbc
      Andreas Rheinhardt authored
      Don't use typedef struct MXFTrack {...} MXFTimecodeComponent, in
      particular given the fact that MXFTrack is a type of its own.
      Reviewed-by: 's avatarTomas Härdin <tjoppen@acc.umu.se>
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      8d019dbc
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Check that Cluster has been opened · 5d24b684
      Andreas Rheinhardt authored
      before setting the field indicating that a Cluster has been opened.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      5d24b684
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Remove unused function parameter · 907b7f88
      Andreas Rheinhardt authored
      end_ebml_master_crc32_preliminary() has a MatroskaMuxContext as
      parameter that isn't used at all. So remove it.
      Furthermore it doesn't close its dynamic buffer; it just uses the
      underlying buffer and therefore it only needs a pointer to the
      dynamic buffer, not a pointer to a pointer.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      907b7f88
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Write level 1 elements in one go · d9c21ec6
      Andreas Rheinhardt authored
      Up until now, writing level 1 elements proceeded as follows: First, the
      element id was written to the ordinary output AVIOContext and a dynamic
      buffer was opened for the content of the level 1 element in
      start_ebml_master_crc32(). Then this buffer was actually used and after it
      was closed (in end_ebml_master_crc32()), the size field corresponding to
      the buffer's size was written, after which the actual data was written.
      
      This commit changes this: Nothing is written to the main AVIOContext any
      more in start_ebml_master_crc32(). end_ebml_master_crc32() now writes
      both the id, the length field as well as the data. This implies that
      one can start a level 1 element in memory without outputting anything.
      This is done to enable to test whether enough space has been reserved
      for the Cues (if space has been reserved for them) before writing them.
      A large duration between outputting the header and outputting the rest
      could also break certain streaming usecases like the one from #8578
      (which this commit fixes).
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      d9c21ec6
    • Andreas Rheinhardt's avatar
      avformat/matroskaenc: Simplify writing Cues · 5e3b7bd5
      Andreas Rheinhardt authored
      When the Matroska muxer writes the Cues (the index), it groups index
      entries with the same timestamp into the same CuePoint to save space.
      But given Matroska's variable-length length fields, it either needs
      to have an upper bound of the final size of the CuePoint before writing it
      or the CuePoint has to be assembled in a different buffer, so that after
      having assembled the CuePoint (when the real size is known), the CuePoint's
      header can be written and its data copied after it.
      
      The first of these approaches is the currently used one. This entails
      finding out the number of entries in a CuePoint before starting the
      CuePoint and therefore means that the list is read at least twice.
      Furthermore, a worst-case upper-bound for the length of a single entry
      was used, so that sometimes bytes are wasted on length fields.
      
      This commit switches to the second approach. This is no longer more
      expensive than the current approach if one only resets the dynamic
      buffer used to write the CuePoint's content instead of opening a new
      buffer for every CuePoint: Writing the trailer of a file with 540.000
      CuePoints improved actually from 219054414 decicycles to 2164379394
      decicycles (based upon 50 iterations).
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
      5e3b7bd5