[vlc-commits] directsound: fix crash when guid is NULL

Thomas Guillem git at videolan.org
Tue Jul 10 14:27:13 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jul 10 14:24:32 2018 +0200| [22bc62b75bd7ad25b693461b4432230d73c80148] | committer: Thomas Guillem

directsound: fix crash when guid is NULL

This happened, very rarely, when the user explicitly selected the mmdevice aout
with the directsound backend and with a specific volume start level.

Fixes CD d75ffdd0-0354-411f-9c6a-339d30c5031a

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

 modules/audio_output/directsound.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c
index 69733b32b1..c687dc7b17 100644
--- a/modules/audio_output/directsound.c
+++ b/modules/audio_output/directsound.c
@@ -836,20 +836,26 @@ static HRESULT StreamStart( aout_stream_t *s,
     if( unlikely(sys == NULL) )
         return E_OUTOFMEMORY;
 
-    DIRECTX_AUDIO_ACTIVATION_PARAMS params = {
-        .cbDirectXAudioActivationParams = sizeof( params ),
-        .guidAudioSession = *sid,
-        .dwAudioStreamFlags = 0,
-    };
-    PROPVARIANT prop;
-
-    PropVariantInit( &prop );
-    prop.vt = VT_BLOB;
-    prop.blob.cbSize = sizeof( params );
-    prop.blob.pBlobData = (BYTE *)¶ms;
-
     void *pv;
-    HRESULT hr = aout_stream_Activate( s, &IID_IDirectSound, &prop, &pv );
+    HRESULT hr;
+    if( sid )
+    {
+        DIRECTX_AUDIO_ACTIVATION_PARAMS params = {
+            .cbDirectXAudioActivationParams = sizeof( params ),
+            .guidAudioSession = *sid,
+            .dwAudioStreamFlags = 0,
+        };
+        PROPVARIANT prop;
+
+        PropVariantInit( &prop );
+        prop.vt = VT_BLOB;
+        prop.blob.cbSize = sizeof( params );
+        prop.blob.pBlobData = (BYTE *)¶ms;
+
+        hr = aout_stream_Activate( s, &IID_IDirectSound, &prop, &pv );
+    }
+    else
+        hr = aout_stream_Activate( s, &IID_IDirectSound, NULL, &pv );
     if( FAILED(hr) )
         goto error;
 



More information about the vlc-commits mailing list