diff mbox series

[FFmpeg-devel,13/31] fftools/ffmpeg: refactor disabling decoder threading for attached pictures

Message ID 20240124081702.4759-13-anton@khirnov.net
State Accepted
Commit a938f47916f1035a9d89e3b0ce9fbf04915956d9
Headers show
Series [FFmpeg-devel,01/31] fftools/ffmpeg_dec: split Decoder into a private and public part | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Jan. 24, 2024, 8:16 a.m. UTC
* as this decision is based on demuxing information, move it from the
  decoder to the demuxer
* as the issue being addressed is latency added by frame threading, we
  only need to disable frame threading, not all threading
---
 fftools/ffmpeg_dec.c   | 3 ---
 fftools/ffmpeg_demux.c | 5 +++++
 2 files changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 7037175a48..e0d8e27098 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -960,9 +960,6 @@  int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
 
     if (!av_dict_get(*dec_opts, "threads", NULL, 0))
         av_dict_set(dec_opts, "threads", "auto", 0);
-    /* Attached pics are sparse, therefore we would not want to delay their decoding till EOF. */
-    if (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)
-        av_dict_set(dec_opts, "threads", "1", 0);
 
     av_dict_set(dec_opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY);
 
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 02add669a0..d804358d55 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1259,6 +1259,11 @@  static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
     if (o->bitexact)
         av_dict_set(&ist->decoder_opts, "flags", "+bitexact", AV_DICT_MULTIKEY);
 
+    /* Attached pics are sparse, therefore we would not want to delay their decoding
+     * till EOF. */
+    if (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)
+        av_dict_set(&ist->decoder_opts, "thread_type", "-frame", 0);
+
     switch (par->codec_type) {
     case AVMEDIA_TYPE_VIDEO:
         MATCH_PER_STREAM_OPT(frame_rates, str, framerate, ic, st);