[vlc-devel] [PATCH V2 5/8] wasapi: respect IsFormatSupported documentation

Thomas Guillem thomas at gllm.fr
Fri Nov 8 18:13:11 CET 2019


The documentation says: "For exclusive mode, set ppClosestMatch to NULL".
---
 modules/audio_output/wasapi.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 701667d6eeb..3bb7d40ef33 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -615,6 +615,10 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
         shared_mode = AUDCLNT_SHAREMODE_EXCLUSIVE;
         /* The max buffer duration in exclusive mode is 200ms */
         buffer_duration = MSFTIME_FROM_MS(200);
+
+        hr = IAudioClient_IsFormatSupported(sys->client, shared_mode,
+                                            pwf, NULL);
+        pwf_closest = NULL;
     }
     else if (AOUT_FMT_LINEAR(&fmt))
     {
@@ -640,15 +644,13 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
             vlc_ToWave(pwfe, &fmt);
             buffer_duration = MSFTIME_FROM_VLC_TICK(AOUT_MAX_PREPARE_TIME);
         }
+
+        hr = IAudioClient_IsFormatSupported(sys->client, shared_mode,
+                                            pwf, &pwf_closest);
     }
     else
-    {
         hr = E_FAIL;
-        goto error;
-    }
 
-    hr = IAudioClient_IsFormatSupported(sys->client, shared_mode,
-                                        pwf, &pwf_closest);
 
     if (FAILED(hr))
     {
-- 
2.20.1



More information about the vlc-devel mailing list