summaryrefslogtreecommitdiff
path: root/libavformat/avformat.h
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2014-01-20 13:28:37 +0100
committerAnton Khirnov <anton@khirnov.net>2014-02-04 22:01:42 +0100
commitd9ae1031f5edbd25c8526b4cb51aba66d3bee931 (patch)
tree8bf19706029f996334e900cb10e47ec97c1d1db7 /libavformat/avformat.h
parent4c3e1956ee35fdcc5ffdb28782050164b4623c0b (diff)
lavf: improve handling of sparse streams when muxing
Currently ff_interleave_packet_per_dts() waits until it gets a frame for each stream before outputting packets in interleaved order. Sparse streams (i.e. streams with much fewer packets than the other streams, like subtitles or audio with DTX) tend to add up latency and in specific cases end up allocating a large amount of memory. Emit the top packet from the packet_buffer if it has a time delta larger than a specified threshold. Original report of the issue and initial proposed solution by mus.svz@gmail.com. Bug-id: 31 Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/avformat.h')
-rw-r--r--libavformat/avformat.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 00380d7b6c..ab09efd4bb 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1002,6 +1002,25 @@ typedef struct AVFormatContext {
*/
int debug;
#define FF_FDEBUG_TS 0x0001
+
+ /**
+ * Maximum buffering duration for interleaving.
+ *
+ * To ensure all the streams are interleaved correctly,
+ * av_interleaved_write_frame() will wait until it has at least one packet
+ * for each stream before actually writing any packets to the output file.
+ * When some streams are "sparse" (i.e. there are large gaps between
+ * successive packets), this can result in excessive buffering.
+ *
+ * This field specifies the maximum difference between the timestamps of the
+ * first and the last packet in the muxing queue, above which libavformat
+ * will output a packet regardless of whether it has queued a packet for all
+ * the streams.
+ *
+ * Muxing only, set by the caller before avformat_write_header().
+ */
+ int64_t max_interleave_delta;
+
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavformat and can be changed and