From: Paul Gofman pgofman@codeweavers.com
--- dlls/mmdevapi/tests/render.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c index 236a4ff71c8..2cbbe496ba6 100644 --- a/dlls/mmdevapi/tests/render.c +++ b/dlls/mmdevapi/tests/render.c @@ -182,9 +182,6 @@ static void test_audioclient(void)
handle = CreateEventW(NULL, FALSE, FALSE, NULL);
- hr = IAudioClient_QueryInterface(ac, &IID_IUnknown, NULL); - ok(hr == E_POINTER, "QueryInterface(NULL) returned %08lx\n", hr); - unk = (void*)(LONG_PTR)0x12345678; hr = IAudioClient_QueryInterface(ac, &IID_NULL, (void**)&unk); ok(hr == E_NOINTERFACE, "QueryInterface(IID_NULL) returned %08lx\n", hr); @@ -197,7 +194,6 @@ static void test_audioclient(void) ref = IUnknown_Release(unk); ok(ref == 1, "Released count is %lu\n", ref); } - hr = IAudioClient_QueryInterface(ac, &IID_IAudioClient, (void**)&unk); ok(hr == S_OK, "QueryInterface(IID_IAudioClient) returned %08lx\n", hr); if (unk)
From: Paul Gofman pgofman@codeweavers.com
--- dlls/mmdevapi/client.c | 3 ++- dlls/mmdevapi/tests/render.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index 39cbae27b34..15ae213a1dc 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -1064,7 +1064,8 @@ static HRESULT WINAPI client_GetSharedModeEnginePeriod(IAudioClient3 *iface, return hr;
*default_period_frames = def_period * format->nSamplesPerSec / (REFERENCE_TIME)10000000; - *min_period_frames = min_period * format->nSamplesPerSec / (REFERENCE_TIME)10000000; + *min_period_frames = (min_period * format->nSamplesPerSec + 10000000 - 1) / (REFERENCE_TIME)10000000; + *default_period_frames = max( *default_period_frames, *min_period_frames ); *max_period_frames = *default_period_frames; *unit_period_frames = 1;
diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c index 2cbbe496ba6..38e28e1ee7d 100644 --- a/dlls/mmdevapi/tests/render.c +++ b/dlls/mmdevapi/tests/render.c @@ -368,6 +368,20 @@ static void test_audioclient(void) hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac); ok(hr == S_OK, "Activation failed with %08lx\n", hr); + + hr = IAudioClient_QueryInterface(ac, &IID_IAudioClient3, (void**)&ac3); + ok(hr == S_OK, "Failed to query IAudioClient3 interface: %08lx\n", hr); + + hr = IAudioClient3_InitializeSharedAudioStream( + ac3, AUDCLNT_SHAREMODE_SHARED, min_period, pwfx, NULL); + ok(hr == S_OK, "InitializeSharedAudioStream returns %08lx\n", hr); + + IAudioClient3_Release(ac3); + IAudioClient_Release(ac); + + hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, + NULL, (void**)&ac); + ok(hr == S_OK, "Activation failed with %08lx\n", hr); } else win_skip("IAudioClient3 is not present\n");
Currently IAudioClient3_InitializeSharedAudioStream called with period obtained as min period from IAudioClient3_GetSharedModeEnginePeriod() outright fails (e. g., with 48000 samples per second) because after rounding down the period ends up smaller than actual min period (in internal representation).
This fixes Malody V crashing on start.
The first patch is obviously unrelated but now that test crashes here on bare hadrware Windows 11.