1. 27 Nov, 2014 5 commits
    • wm4's avatar
      lavu: fix memory leaks by using a mutex instead of atomics · fbd6c97f
      wm4 authored
      The buffer pool has to atomically add and remove entries from the linked
      list of available buffers. This was done by removing the entire list
      with a CAS operation, working on it, and then setting it back again
      (using a retry-loop in case another thread was doing the same thing).
      
      This could effectively cause memory leaks: while a thread was working on
      the buffer list, other threads would allocate new buffers, increasing
      the pool's total size. There was no real leak, but since these extra
      buffers were not needed, but not free'd either (except when the buffer
      pool was destroyed), this had the same effects as a real leak. For some
      reason, growth was exponential, and could easily kill the process due
      to OOM in real-world uses.
      
      Fix this by using a mutex to protect the list operations. The fancy
      way atomics remove the whole list to work on it is not needed anymore,
      which also avoids the situation which was causing the leak.
      Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
      fbd6c97f
    • Anton Khirnov's avatar
      lavu: add wrappers for the pthreads mutex API · 2443e522
      Anton Khirnov authored
      Also add no-op fallbacks when threading is disabled.
      
      This helps keeping the code clean if Libav is compiled for targets
      without threading. Since we assume that no threads of any kind are used
      in such configurations, doing nothing is ok by definition.
      
      Based on a patch by wm4 <nfxjfg@googlemail.com>.
      2443e522
    • Martin Storsjö's avatar
      Revert "lavf: Don't try to update files atomically with renames on windows" · 675ac56b
      Martin Storsjö authored
      This reverts commit b9d08c77.
      
      After taking MoveFileEx into use, we can replace files with renames
      on windows as well.
      Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
      675ac56b
    • Martin Storsjö's avatar
      lavf: Use MoveFileEx instead of rename/_wrename on windows · 79fd186a
      Martin Storsjö authored
      This allows getting the normal unix semantics, where a rename
      allows replacing an existing file.
      
      Based on a suggestion by Reimar Döffinger.
      Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
      79fd186a
    • Martin Storsjö's avatar
      Share the utf8 to wchar conversion routine between lavf and lavu · 9326d64e
      Martin Storsjö authored
      This doesn't add any dependency on library internals, since this
      only is a static inline function that gets built into each of the
      calling functions - this is only to reduce the code duplication.
      Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
      9326d64e
  2. 26 Nov, 2014 2 commits
    • Martin Storsjö's avatar
      movenc: Expose the fragment index as an avoption · 234fb81e
      Martin Storsjö authored
      This allows setting the right fragment number if doing
      random-access writing of fragments, and also allows reading the
      current sequence number.
      Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
      234fb81e
    • Martin Storsjö's avatar
      movenc: Add a flag for indicating a discontinuous fragment · ee37620b
      Martin Storsjö authored
      This allows creating a later mp4 fragment without sequentially
      writing the earlier ones before (when called from a segmenter).
      
      Normally when writing a fragmented mp4 file sequentially, the
      first timestamps of a fragment are adjusted to match the
      end of the previous fragment, to make sure the timestamp is the
      same, even if it is calculated as the sum of previous fragment
      durations. (And for the first packet in a file, the offset of
      the first packet is written using an edit list.)
      
      When writing an individual mp4 fragment discontinuously like this
      (with potentially writing the earlier fragments separately later),
      there's a risk of getting a gap in the timeline if the duration
      field of the last packet in the previous fragment doesn't match up
      with the start time of the next fragment.
      
      Using this requires setting -avoid_negative_ts make_non_negative
      (or -avoid_negative_ts 0).
      Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
      ee37620b
  3. 25 Nov, 2014 10 commits
  4. 24 Nov, 2014 14 commits
  5. 22 Nov, 2014 3 commits
  6. 21 Nov, 2014 6 commits