amstream: Increase parent IAMMediaStream refcount in IAudioMediaStream::CreateSample().

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2020-07-29 14:43:59 +02:00 committed by Alexandre Julliard
parent d17b118f03
commit 08c076f542
2 changed files with 5 additions and 0 deletions

View File

@ -201,6 +201,7 @@ static ULONG WINAPI IAudioStreamSampleImpl_Release(IAudioStreamSample *iface)
if (!ref)
{
IAMMediaStream_Release(&This->parent->IAMMediaStream_iface);
CloseHandle(This->update_event);
HeapFree(GetProcessHeap(), 0, This);
}
@ -375,6 +376,7 @@ static HRESULT audiostreamsample_create(struct audio_stream *parent, IAudioData
object->IAudioStreamSample_iface.lpVtbl = &AudioStreamSample_Vtbl;
object->ref = 1;
object->parent = parent;
IAMMediaStream_AddRef(&parent->IAMMediaStream_iface);
object->audio_data = audio_data;
object->update_event = CreateEventW(NULL, FALSE, FALSE, NULL);

View File

@ -1505,8 +1505,11 @@ static void test_media_streams(void)
hr = IAudioMediaStream_CreateSample(audio_media_stream, NULL, 0, &audio_sample);
ok(hr == E_POINTER, "IAudioMediaStream_CreateSample returned: %x\n", hr);
EXPECT_REF(audio_stream, 3);
hr = IAudioMediaStream_CreateSample(audio_media_stream, audio_data, 0, &audio_sample);
ok(hr == S_OK, "IAudioMediaStream_CreateSample returned: %x\n", hr);
EXPECT_REF(audio_stream, 4);
hr = IAudioMediaStream_GetMultiMediaStream(audio_media_stream, NULL);
ok(hr == E_POINTER, "Expected E_POINTER, got %x\n", hr);