summaryrefslogtreecommitdiff
path: root/avconv_opt.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-05-23 10:48:26 +0200
committerAnton Khirnov <anton@khirnov.net>2016-06-25 11:15:54 +0200
commit398f015f077c6a2406deffd9e37ff34b9c7bb3bc (patch)
tree87e70d2671e9eee65fee61e1de79e634340b9fec /avconv_opt.c
parent1c169782cae6c5c430ff62e7d7272dc9d0e8d527 (diff)
avconv: buffer the packets written while the muxer is not initialized
Diffstat (limited to 'avconv_opt.c')
-rw-r--r--avconv_opt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/avconv_opt.c b/avconv_opt.c
index 2a4f71a6ff..a1729c30e5 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -1073,6 +1073,10 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
ost->enc_ctx->global_quality = FF_QP2LAMBDA * qscale;
}
+ ost->max_muxing_queue_size = 128;
+ MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st);
+ ost->max_muxing_queue_size *= sizeof(AVPacket);
+
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
@@ -1083,6 +1087,10 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
ost->pix_fmts[0] = ost->pix_fmts[1] = AV_PIX_FMT_NONE;
ost->last_mux_dts = AV_NOPTS_VALUE;
+ ost->muxing_queue = av_fifo_alloc(8 * sizeof(AVPacket));
+ if (!ost->muxing_queue)
+ exit_program(1);
+
return ost;
}
@@ -2648,6 +2656,9 @@ const OptionDef options[] = {
{ "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(bitstream_filters) },
"A comma-separated list of bitstream filters", "bitstream_filters" },
+ { "max_muxing_queue_size", HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(max_muxing_queue_size) },
+ "maximum number of packets that can be buffered while waiting for all streams to initialize", "packets" },
+
/* data codec support */
{ "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_data_codec },
"force data codec ('copy' to copy stream)", "codec" },