[vlc-commits] wasapi: respect IsFormatSupported documentation

Thomas Guillem git at videolan.org
Tue Nov 26 15:30:13 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Oct 23 11:32:39 2019 +0200| [ba92afa31ba19207624f3f4c702a3d30a0c78042] | committer: Thomas Guillem

wasapi: respect IsFormatSupported documentation

The documentation says: "For exclusive mode, set ppClosestMatch to NULL".

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ba92afa31ba19207624f3f4c702a3d30a0c78042
---

 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 70284f41aa..d593cbe630 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -612,6 +612,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))
     {
@@ -637,15 +641,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))
     {



More information about the vlc-commits mailing list