Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/multimedia.c | 7 +++++++ dlls/amstream/tests/amstream.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index c3c806b36f..6643d5d141 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -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)) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 6497dde91c..ef6c477843 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -651,7 +651,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); @@ -701,7 +701,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);