0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

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.
This commit is contained in:
Philip Langdale 2023-07-31 09:29:08 +08:00 committed by Philip Langdale
parent 59478b0059
commit 05a4f57703

View File

@ -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;
}