Commit 7056f421 authored by Bernhard Kölbl's avatar Bernhard Kölbl Committed by Alexandre Julliard

mf: Don't try to clone non existent topo connections.

parent 79ce998e
......@@ -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)
......
......@@ -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)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment