-thread_queue_size is no longer respected for input files after the
threading changes, but it is still accepted as an input option.

Reject it when used for input files, while keeping output-side behavior
unchanged. Update the documentation accordingly.

Fixes ticket #11184.

Signed-off-by: yyyam0693 <[email protected]>
---
 doc/ffmpeg.texi      | 15 ++++++---------
 fftools/ffmpeg_opt.c | 28 +++++++++++++++++++++++++---
 2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 533131a..cd21a74 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -2748,15 +2748,12 @@ to the @option{-ss} option is considered an actual 
timestamp, and is not
 offset by the start time of the file. This matters only for files which do
 not start from timestamp 0, such as transport streams.
 
-@item -thread_queue_size @var{size} (@emph{input/output})
-For input, this option sets the maximum number of queued packets when reading
-from the file or device. With low latency / high rate live streams, packets may
-be discarded if they are not read in a timely manner; setting this value can
-force ffmpeg to use a separate input thread and read packets as soon as they
-arrive. By default ffmpeg only does this if multiple inputs are specified.
-
-For output, this option specified the maximum number of packets that may be
-queued to each muxing thread.
+@item -thread_queue_size @var{size} (@emph{output})
+For output, this option sets the maximum number of queued packets that may be 
+buffered before being sent to the muxer.
+
+As an input option, @option{-thread_queue_size} is no longer supported and 
+will result in an error.
 
 @item -sdp_file @var{file} (@emph{global})
 Print sdp information for an output stream to @var{file}.
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 48e6816..1908573 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1231,6 +1231,28 @@ static int opt_audio_filters(void *optctx, const char 
*opt, const char *arg)
     return parse_option(o, "filter:a", arg, options);
 }
 
+static int opt_thread_queue_size(void *optctx, const char *opt, const char 
*arg)
+{
+    OptionsContext *o = optctx;
+    double queue_size;
+    int ret;
+
+    if (o->g && o->g->group_def && (o->g->group_def->flags & OPT_INPUT)) {
+        av_log(NULL, AV_LOG_ERROR,
+               "The -%s option is no longer supported for input files and "
+               "has no effect; it is only supported for output files.\n",
+               opt);
+        return AVERROR(EINVAL);
+    }
+
+    ret = parse_number(opt, arg, OPT_TYPE_INT, INT_MIN, INT_MAX, &queue_size);
+    if (ret < 0)
+        return ret;
+
+    o->thread_queue_size = queue_size;
+    return 0;
+}
+
 #if FFMPEG_OPT_VSYNC
 static int opt_vsync(void *optctx, const char *opt, const char *arg)
 {
@@ -1879,9 +1901,9 @@ const OptionDef options[] = {
     { "disposition",         OPT_TYPE_STRING, OPT_PERSTREAM | OPT_OUTPUT | 
OPT_EXPERT,
         { .off = OFFSET(disposition) },
         "disposition", "" },
-    { "thread_queue_size",   OPT_TYPE_INT,  OPT_OFFSET | OPT_EXPERT | 
OPT_INPUT | OPT_OUTPUT,
-        { .off = OFFSET(thread_queue_size) },
-        "set the maximum number of queued packets from the demuxer" },
+    { "thread_queue_size",   OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | 
OPT_EXPERT | OPT_INPUT | OPT_OUTPUT,
+        { .func_arg = opt_thread_queue_size },
+        "set the maximum number of queued packets for the muxer" },
     { "find_stream_info",    OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT | 
OPT_OFFSET,
         { .off = OFFSET(find_stream_info) },
         "read and decode the streams to fill missing information with 
heuristics" },
-- 
2.52.0.windows.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to