amstream: Forbid changing the graph in IAMMultiMediaStream::Initialize().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-03-04 22:33:35 -06:00 committed by Alexandre Julliard
parent 20004d1557
commit fa62cde374
2 changed files with 15 additions and 0 deletions

View File

@ -244,6 +244,12 @@ static HRESULT WINAPI multimedia_stream_Initialize(IAMMultiMediaStream *iface,
TRACE("mmstream %p, type %u, flags %#x, graph %p.\n", mmstream, type, flags, graph); TRACE("mmstream %p, type %u, flags %#x, graph %p.\n", mmstream, type, flags, graph);
if (graph && mmstream->graph)
{
WARN("Graph already initialized, returning E_INVALIDARG.\n");
return E_INVALIDARG;
}
if (graph && FAILED(hr = create_graph(mmstream, graph))) if (graph && FAILED(hr = create_graph(mmstream, graph)))
return hr; return hr;

View File

@ -1646,6 +1646,15 @@ static void test_initialize(void)
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!got_add_filter, "Got %d calls to IGraphBuilder::AddFilter().\n", got_add_filter); ok(!got_add_filter, "Got %d calls to IGraphBuilder::AddFilter().\n", got_add_filter);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, (IGraphBuilder *)&graph);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
IMediaStreamFilter_Release(filter); IMediaStreamFilter_Release(filter);
ref = IAMMultiMediaStream_Release(mmstream); ref = IAMMultiMediaStream_Release(mmstream);
ok(!ref, "Got outstanding refcount %d.\n", ref); ok(!ref, "Got outstanding refcount %d.\n", ref);