I put the tests in the same commit as the implementation due to crashes, I can also split them again if needed.
Signed-off-by: Bernhard Kölbl besentv@gmail.com
-- v3: mf: Don't try to clone non existent topo connections.
From: Bernhard Kölbl besentv@gmail.com
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/mf/tests/mf.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/mf/topology.c | 7 ++++++- 2 files changed, 56 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index e8d7252aa3f..010c8b2bd12 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1194,6 +1194,56 @@ static void test_topology(void) ok(ref == 0, "Release returned %ld\n", ref); ref = IMFTopologyNode_Release(node2); ok(ref == 0, "Release returned %ld\n", ref); + + /* Try cloning a topology without all outputs connected */ + hr = MFCreateTopology(&topology); + ok(hr == S_OK, "Failed to create topology, hr %#lx.\n", hr); + + hr = MFCreateTopology(&topology2); + ok(hr == S_OK, "Failed to create topology, hr %#lx.\n", hr); + + hr = MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, &node); + ok(hr == S_OK, "Failed to create topology node, hr %#lx.\n", hr); + + hr = IMFTopology_AddNode(topology, node); + ok(hr == S_OK, "Failed to add a node, hr %#lx.\n", hr); + EXPECT_REF(node, 2); + + hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &node2); + ok(hr == S_OK, "Failed to create topology node, hr %#lx.\n", hr); + + hr = IMFTopology_AddNode(topology, node2); + ok(hr == S_OK, "Failed to add a node, hr %#lx.\n", hr); + EXPECT_REF(node, 2); + + hr = IMFTopologyNode_ConnectOutput(node, 1, node2, 0); + ok(hr == S_OK, "Failed to connect output, hr %#lx.\n", hr); + + hr = IMFTopology_CloneFrom(topology2, topology); + ok(hr == S_OK, "Failed to clone from topology, hr %#lx.\n", hr); + + hr = IMFTopology_GetNodeCount(topology2, &node_count); + ok(hr == S_OK, "Failed to get node count, hr %#lx.\n", hr); + ok(node_count == 2, "Unexpected node count %u.\n", node_count); + + hr = IMFTopology_GetNode(topology2, 0, &node3); + ok(hr == S_OK, "Failed to get node, hr %#lx.\n", hr); + + hr = IMFTopologyNode_GetOutputCount(node3, &size); + ok(hr == S_OK, "Failed to get output count, hr %#lx.\n", hr); + ok(size == 2, "Unexpected output count %lu.\n", size); + + IMFTopologyNode_Release(node3); + + ref = IMFTopology_Release(topology2); + ok(ref == 0, "Release returned %ld\n", ref); + ref = IMFTopology_Release(topology); + ok(ref == 0, "Release returned %ld\n", ref); + + ref = IMFTopologyNode_Release(node2); + ok(ref == 0, "Release returned %ld\n", ref); + ref = IMFTopologyNode_Release(node); + ok(ref == 0, "Release returned %ld\n", ref); }
static void test_topology_tee_node(void) diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 25a00708100..b684b17ff72 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -712,7 +712,12 @@ static HRESULT WINAPI topology_CloneFrom(IMFTopology *iface, IMFTopology *src) for (j = 0; j < outputs->count; ++j) { DWORD input_index = outputs->streams[j].connection_stream; - TOPOID id = outputs->streams[j].connection->id; + TOPOID id; + + if (!outputs->streams[j].connection) + continue; + + id = outputs->streams[j].connection->id;
/* Skip node lookup in destination topology, assuming same node order. */ if (SUCCEEDED(hr = topology_get_node_by_id(topology, id, &node)))
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=132797
Your paranoid android.
=== w7u_el (32 bit report) ===
mf: mf: Timeout
Some leftover code sneaked in, should be fine now.
This merge request was approved by Nikolay Sivov.