From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/amstream/multimedia.c | 33 +++++++-------------------------- dlls/amstream/tests/amstream.c | 4 ++-- 2 files changed, 9 insertions(+), 28 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 1449c457992..55c13286eee 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -39,8 +39,6 @@ struct multimedia_stream IMediaControl* media_control; IMediaStreamFilter *filter; IPin* ipin; - ULONG nbStreams; - IAMMediaStream **pStreams; STREAM_TYPE StreamType; OAEVENT event; }; @@ -85,15 +83,11 @@ static ULONG WINAPI multimedia_stream_Release(IAMMultiMediaStream *iface) { struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); ULONG ref = InterlockedDecrement(&This->ref); - ULONG i;
TRACE("(%p/%p)\n", iface, This);
if (!ref) { - for(i = 0; i < This->nbStreams; i++) - IAMMediaStream_Release(This->pStreams[i]); - CoTaskMemFree(This->pStreams); if (This->ipin) IPin_Release(This->ipin); IMediaStreamFilter_Release(This->filter); @@ -291,14 +285,14 @@ static HRESULT WINAPI multimedia_stream_GetFilter(IAMMultiMediaStream *iface, }
static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *iface, - IUnknown *stream_object, const MSPID *PurposeId, DWORD dwFlags, IMediaStream **ppNewStream) + IUnknown *stream_object, const MSPID *PurposeId, DWORD dwFlags, IMediaStream **ret_stream) { struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); HRESULT hr; IAMMediaStream* pStream; - IAMMediaStream** pNewStreams;
- TRACE("(%p/%p)->(%p,%s,%x,%p)\n", This, iface, stream_object, debugstr_guid(PurposeId), dwFlags, ppNewStream); + TRACE("mmstream %p, stream_object %p, id %s, flags %#x, ret_stream %p.\n", + This, stream_object, debugstr_guid(PurposeId), dwFlags, ret_stream);
if (!IsEqualGUID(PurposeId, &MSPID_PrimaryVideo) && !IsEqualGUID(PurposeId, &MSPID_PrimaryAudio)) return MS_E_PURPOSEID; @@ -331,28 +325,15 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac hr = ddrawmediastream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->StreamType, &pStream); else hr = audiomediastream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->StreamType, &pStream); - if (SUCCEEDED(hr)) - { - pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IAMMediaStream*)); - if (!pNewStreams) - { - IAMMediaStream_Release(pStream); - return E_OUTOFMEMORY; - } - This->pStreams = pNewStreams; - This->pStreams[This->nbStreams] = pStream; - This->nbStreams++; - - if (ppNewStream) - { - IMediaStream_AddRef(*ppNewStream = (IMediaStream*)pStream); - } - }
if (SUCCEEDED(hr)) { /* Add stream to the media stream filter */ IMediaStreamFilter_AddMediaStream(This->filter, pStream); + if (ret_stream) + *ret_stream = (IMediaStream *)pStream; + else + IAMMediaStream_Release(pStream); }
return hr; diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index b83e7bc1a84..24c48ec5584 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -1152,7 +1152,7 @@ static void test_enum_pins(void) ref = get_refcount(enum1); ok(ref == 1, "Got unexpected refcount %d.\n", ref); ref = get_refcount(pin); - todo_wine ok(ref == 4, "Got unexpected refcount %d.\n", ref); + ok(ref == 4, "Got unexpected refcount %d.\n", ref);
hr = IEnumPins_Next(enum1, 1, pins, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -1162,7 +1162,7 @@ static void test_enum_pins(void) ref = get_refcount(enum1); ok(ref == 1, "Got unexpected refcount %d.\n", ref); ref = get_refcount(pin); - todo_wine ok(ref == 5, "Got unexpected refcount %d.\n", ref); + ok(ref == 5, "Got unexpected refcount %d.\n", ref); IPin_Release(pins[0]);
hr = IEnumPins_Next(enum1, 1, pins, NULL);