Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/amstream/audiostream.c | 2 ++ dlls/amstream/tests/amstream.c | 3 +++ 2 files changed, 5 insertions(+)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index 112891eeb7..e888caaa98 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -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);
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 68d2b9c18f..17f00dcdf9 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -1421,8 +1421,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);
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/amstream/audiostream.c | 2 ++ dlls/amstream/tests/amstream.c | 2 ++ 2 files changed, 4 insertions(+)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index e888caaa98..85613f4f0e 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -202,6 +202,7 @@ static ULONG WINAPI IAudioStreamSampleImpl_Release(IAudioStreamSample *iface) if (!ref) { IAMMediaStream_Release(&This->parent->IAMMediaStream_iface); + IAudioData_Release(This->audio_data); CloseHandle(This->update_event); HeapFree(GetProcessHeap(), 0, This); } @@ -378,6 +379,7 @@ static HRESULT audiostreamsample_create(struct audio_stream *parent, IAudioData object->parent = parent; IAMMediaStream_AddRef(&parent->IAMMediaStream_iface); object->audio_data = audio_data; + IAudioData_AddRef(audio_data); object->update_event = CreateEventW(NULL, FALSE, FALSE, NULL);
*audio_stream_sample = &object->IAudioStreamSample_iface; diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 17f00dcdf9..41dce567fa 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -1423,9 +1423,11 @@ static void test_media_streams(void) ok(hr == E_POINTER, "IAudioMediaStream_CreateSample returned: %x\n", hr);
EXPECT_REF(audio_stream, 3); + EXPECT_REF(audio_data, 1); 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); + EXPECT_REF(audio_data, 2);
hr = IAudioMediaStream_GetMultiMediaStream(audio_media_stream, NULL); ok(hr == E_POINTER, "Expected E_POINTER, got %x\n", hr);
Signed-off-by: Zebediah Figura z.figura12@gmail.com