Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/multimedia.c | 25 ++++++++++--------------- dlls/amstream/tests/amstream.c | 3 +++ 2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 6643d5d141..48abcaf8b4 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -305,26 +305,21 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac
if (dwFlags & AMMSF_ADDDEFAULTRENDERER) { - if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) + IBaseFilter *dsound_render; + + if (!IsEqualGUID(PurposeId, &MSPID_PrimaryAudio)) { - /* Default renderer not supported by video stream */ + WARN("AMMSF_ADDDEFAULTRENDERER requested with id %s, returning MS_E_PURPOSEID.\n", debugstr_guid(PurposeId)); return MS_E_PURPOSEID; } - else - { - IBaseFilter* dsoundrender_filter;
- /* Create the default renderer for audio */ - hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&dsoundrender_filter); - if (SUCCEEDED(hr)) - { - hr = IGraphBuilder_AddFilter(This->pFilterGraph, dsoundrender_filter, NULL); - IBaseFilter_Release(dsoundrender_filter); - } - - /* No media stream created when the default renderer is used */ - return hr; + if (SUCCEEDED(hr = CoCreateInstance(&CLSID_DSoundRender, NULL, + CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&dsound_render))) + { + hr = IGraphBuilder_AddFilter(This->pFilterGraph, dsound_render, NULL); + IBaseFilter_Release(dsound_render); } + return hr; }
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 7d38755388..67b504fd3f 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -839,6 +839,9 @@ static void test_add_stream(void) IGraphBuilder_Release(graph); }
+ hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &test_mspid, + AMMSF_ADDDEFAULTRENDERER, NULL); + ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr); hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &test_mspid, AMMSF_ADDDEFAULTRENDERER, &audio_stream); todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);