From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index 0b849e47e3d..a760256540a 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -47,6 +47,8 @@ extern HRESULT get_audio_session(const GUID *sessionguid, IMMDevice *device, UIN struct audio_session **out); extern struct audio_session_wrapper *session_wrapper_create(struct audio_client *client);
+static const REFERENCE_TIME min_def_period = 100000; + static HANDLE main_loop_thread;
void main_loop_stop(void) @@ -122,7 +124,7 @@ static HRESULT adjust_timing(struct audio_client *This, TRACE("Device periods: %lu default and %lu minimum\n", (ULONG)def_period, (ULONG)min_period);
if (mode == AUDCLNT_SHAREMODE_SHARED) { - *period = def_period; + *period = max(def_period, min_def_period); if (*duration < 3 * *period) *duration = 3 * *period; } else { @@ -132,7 +134,7 @@ static HRESULT adjust_timing(struct audio_client *This, params.result = AUDCLNT_E_UNSUPPORTED_FORMAT; else { if (*period == 0) - *period = def_period; + *period = max(def_period, min_def_period); if (*period < min_period || *period > 5000000) params.result = AUDCLNT_E_INVALID_DEVICE_PERIOD; else if (*duration > 20000000) /* The smaller the period, the lower this limit. */ @@ -762,6 +764,9 @@ static HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, REFERENCE_TIM
wine_unix_call(get_device_period, ¶ms);
+ if (defperiod && *defperiod < min_def_period) + *defperiod = min_def_period; + return params.result; }