[PATCH 5/5] amstream: Reference the multimedia stream in ddraw stream sample.
Zebediah Figura
zfigura at codeweavers.com
Tue Oct 6 20:51:49 CDT 2020
On 10/6/20 1:05 PM, Anton Baskanov wrote:
> Signed-off-by: Anton Baskanov <baskanov at gmail.com>
> ---
> dlls/amstream/ddrawstream.c | 4 ++++
> dlls/amstream/tests/amstream.c | 2 ++
> 2 files changed, 6 insertions(+)
>
> diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c
> index 6ea99d4915e..509e489435b 100644
> --- a/dlls/amstream/ddrawstream.c
> +++ b/dlls/amstream/ddrawstream.c
> @@ -69,6 +69,7 @@ struct ddraw_sample
> {
> IDirectDrawStreamSample IDirectDrawStreamSample_iface;
> LONG ref;
> + IMultiMediaStream *mmstream;
> struct ddraw_stream *parent;
> IDirectDrawSurface *surface;
> RECT rect;
> @@ -1462,6 +1463,8 @@ static ULONG WINAPI ddraw_sample_Release(IDirectDrawStreamSample *iface)
> --sample->parent->sample_refs;
> LeaveCriticalSection(&sample->parent->cs);
>
> + if (sample->mmstream)
> + IMultiMediaStream_Release(sample->mmstream);
> IAMMediaStream_Release(&sample->parent->IAMMediaStream_iface);
>
> if (sample->surface)
> @@ -1680,6 +1683,7 @@ static HRESULT ddrawstreamsample_create(struct ddraw_stream *parent, IDirectDraw
> object->parent = parent;
> InitializeConditionVariable(&object->update_cv);
> IAMMediaStream_AddRef(&parent->IAMMediaStream_iface);
> + IAMMediaStream_GetMultiMediaStream(&parent->IAMMediaStream_iface, &object->mmstream);
I think I would prefer accessing parent->parent directly; it's another
two lines of code but avoids extra trace lines.
> ++parent->sample_refs;
>
> if (surface)
> diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
> index 285dc0f0547..9dda5882a4f 100644
> --- a/dlls/amstream/tests/amstream.c
> +++ b/dlls/amstream/tests/amstream.c
> @@ -6904,9 +6904,11 @@ static void test_ddrawstream_create_sample(void)
> hr = IDirectDrawMediaStream_CreateSample(ddraw_stream, NULL, &rect, 0, &sample);
> ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
>
> + EXPECT_REF(mmstream, 1);
> EXPECT_REF(stream, 3);
> hr = IDirectDrawMediaStream_CreateSample(ddraw_stream, NULL, NULL, 0, &sample);
> ok(hr == S_OK, "Got hr %#x.\n", hr);
> + EXPECT_REF(mmstream, 2);
> EXPECT_REF(stream, 4);
>
> hr = IDirectDrawStreamSample_GetSurface(sample, NULL, NULL);
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20201006/2dcaf563/attachment-0001.sig>
More information about the wine-devel
mailing list