Commit ca4f624e authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

amstream: Check for an existing stream in IAMMultiMediaStream::AddMediaStream().

parent 6b04ca02
......@@ -289,6 +289,7 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac
struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
HRESULT hr;
IAMMediaStream* pStream;
IMediaStream *stream;
TRACE("mmstream %p, stream_object %p, id %s, flags %#x, ret_stream %p.\n",
This, stream_object, debugstr_guid(PurposeId), dwFlags, ret_stream);
......@@ -296,6 +297,12 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac
if (!IsEqualGUID(PurposeId, &MSPID_PrimaryVideo) && !IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))
return MS_E_PURPOSEID;
if (IMediaStreamFilter_GetMediaStream(This->filter, PurposeId, &stream) == S_OK)
{
IMediaStream_Release(stream);
return MS_E_PURPOSEID;
}
if (dwFlags & AMMSF_ADDDEFAULTRENDERER)
{
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
......
......@@ -652,7 +652,7 @@ static void test_add_stream(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream);
todo_wine ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr);
ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, 0, NULL);
todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr);
......@@ -702,7 +702,7 @@ static void test_add_stream(void)
todo_wine check_get_stream(mmstream, stream_filter, &test_mspid, (IMediaStream *)&teststream);
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream);
todo_wine ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr);
ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph);
ok(hr == S_OK, "Got hr %#x.\n", hr);
......
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