summaryrefslogtreecommitdiffstats
path: root/filters/f_output_chain.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2023-07-31 09:29:08 +0800
committerPhilip Langdale <github.philipl@overt.org>2023-08-26 10:07:55 -0700
commit05a4f577039a34f9e390b46fe17735e55855b7c2 (patch)
tree3b49fd4a3aa93ee5fba9e7c6a7ef1b23f986d6c1 /filters/f_output_chain.c
parent59478b0059f3af023eb3e9f9d3ac5fa537ce1caf (diff)
downloadmpv-05a4f577039a34f9e390b46fe17735e55855b7c2.tar.bz2
mpv-05a4f577039a34f9e390b46fe17735e55855b7c2.tar.xz
output_chain: don't reset autoconvert on changes to unrelated filters
This has been a standing behaviour for a long time, but I noticed it while implementing the hw->hw autoconvert functionality. Today, the output_chain will reset the autoconvert state when any output_chain filter sees the input format change. This is wasteful as it leads to the image converter having to be reinitialised each time it happens, so we should only do it when the actual "convert" filter sees the input format change. It doesn't matter if one of the other filters in the chain sees a change (although in practice, a format change will basically always propagate down the chain, so they all see a change at the same time). The practical effect of the old behaviour was that a format change would always lead to the image converter being rebuilt twice - once after the "convert" filter sees the format change, and then again after the "out" filter (the end of the chain) sees the change. In this commit, we check which filter is seeing the change, and only reset the autoconvert state for the "convert" filter itself.
Diffstat (limited to 'filters/f_output_chain.c')
-rw-r--r--filters/f_output_chain.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/filters/f_output_chain.c b/filters/f_output_chain.c
index b9ee7060cc..2d4dcba417 100644
--- a/filters/f_output_chain.c
+++ b/filters/f_output_chain.c
@@ -114,7 +114,11 @@ static void check_in_format_change(struct mp_user_filter *u,
// But a common case is enabling HW decoding, which
// might init some support of them in the VO, and update
// the VO's format list.
- update_output_caps(p);
+ //
+ // But as this is only relevant to the "convert" filter, don't
+ // do this for the other filters as it is wasted work.
+ if (strcmp(u->name, "convert") == 0)
+ update_output_caps(p);
p->public.reconfig_happened = true;
}