[PATCH 0/1] MR11092: mf/topology_loader: Restore original type when optional connection fails.
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/mf/topology_loader.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 2dda6250231..5d51550145c 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -806,6 +806,7 @@ static HRESULT topology_branch_connect_optional_chain(IMFTopology *topology, str while (SUCCEEDED(hr) && node != branch->down.node) { IMFTopologyNode *tmp = node; + IMFMediaType *orig; UINT32 method; if (FAILED(IMFTopologyNode_GetUINT32(node, &MF_TOPONODE_CONNECT_METHOD, &method))) @@ -816,18 +817,25 @@ static HRESULT topology_branch_connect_optional_chain(IMFTopology *topology, str * downstream of them. Support for upstream insertion is untested in native, but seems unlikely to work. */ if (FAILED(hr = topology_branch_create_for_input(down_node, down_stream, ¤t))) break; + if (FAILED(hr = IMFMediaTypeHandler_GetCurrentMediaType(current->up.handler, &orig))) + { + topology_branch_destroy(current); + break; + } + if (SUCCEEDED(hr = topology_branch_create_optional(topology, current, node, stream, &up_branch, &down_branch))) { if (FAILED(hr = topology_branch_connect(topology, CONNECT_DIRECT, up_branch, NULL, !!method)) || FAILED(hr = topology_branch_connect(topology, CONNECT_DIRECT, down_branch, NULL, FALSE))) { - if (FAILED(hr = topology_branch_connect(topology, CONNECT_DIRECT, current, NULL, FALSE))) + if (FAILED(hr = topology_branch_connect_with_type(topology, current, orig))) WARN("Failed to restore previous branch %s\n", debugstr_topology_branch(current)); IMFTopology_RemoveNode(topology, down_branch->up.node); } topology_branch_destroy(down_branch); topology_branch_destroy(up_branch); } + IMFMediaType_Release(orig); topology_branch_destroy(current); hr = IMFTopologyNode_GetOutput(tmp, 0, &node, &stream); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11092
participants (2)
-
Rémi Bernon -
Rémi Bernon (@rbernon)