From ae41ce2d9359a1c3051eb1e10ca3ddfbb534c3e2 Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Wed, 2 Jun 2021 23:07:53 +0900 Subject: [PATCH] quartz/tests: Introduce commit_allocator helper in vmr7.c. Signed-off-by: Akihiro Sagawa Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/tests/vmr7.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 02b5a626d74..5a2c33f6145 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -1021,6 +1021,18 @@ static HRESULT join_thread_(int line, HANDLE thread) } #define join_thread(a) join_thread_(__LINE__, a) +static void commit_allocator(IMemInputPin *input) +{ + IMemAllocator *allocator; + HRESULT hr; + + hr = IMemInputPin_GetAllocator(input, &allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMemAllocator_Commit(allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IMemAllocator_Release(allocator); +} + static void test_filter_state(IMemInputPin *input, IMediaControl *control) { IMemAllocator *allocator; @@ -1130,9 +1142,7 @@ static void test_filter_state(IMemInputPin *input, IMediaControl *control) hr = IMediaControl_GetState(control, 0, &state); ok(hr == S_OK, "Got hr %#x.\n", hr); - hr = IMemAllocator_Commit(allocator); - ok(hr == S_OK, "Got hr %#x.\n", hr); - + commit_allocator(input); hr = IMediaControl_Pause(control); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -1163,17 +1173,11 @@ static void test_filter_state(IMemInputPin *input, IMediaControl *control) static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control) { - IMemAllocator *allocator; OAFilterState state; HANDLE thread; HRESULT hr; - hr = IMemInputPin_GetAllocator(input, &allocator); - ok(hr == S_OK, "Got hr %#x.\n", hr); - hr = IMemAllocator_Commit(allocator); - ok(hr == S_OK, "Got hr %#x.\n", hr); - IMemAllocator_Release(allocator); - + commit_allocator(input); hr = IMediaControl_Pause(control); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -1239,7 +1243,6 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input, const BITMAPINFOHEADER *bih = (BITMAPINFOHEADER *)buffer; const DWORD *data = (DWORD *)((char *)buffer + sizeof(BITMAPINFOHEADER)); BITMAPINFOHEADER expect_bih = *req_bih; - IMemAllocator *allocator; OAFilterState state; IBasicVideo *video; unsigned int i; @@ -1272,12 +1275,7 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input, ok(!memcmp(bih, &expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n"); /* The contents seem to reflect the last frame rendered. */ - hr = IMemInputPin_GetAllocator(input, &allocator); - ok(hr == S_OK, "Got hr %#x.\n", hr); - hr = IMemAllocator_Commit(allocator); - ok(hr == S_OK, "Got hr %#x.\n", hr); - IMemAllocator_Release(allocator); - + commit_allocator(input); hr = IMediaControl_Pause(control); ok(hr == S_FALSE, "Got hr %#x.\n", hr);