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

amstream: Don't keep track of streams in the multimedia stream object.

parent 6d6ea5dc
......@@ -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;
......
......@@ -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);
......
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