]> git.sesse.net Git - vlc/commitdiff
directsound: fix TimeGet returning a positive value on error
authorSteve Lhomme <robUx4@videolabs.io>
Thu, 19 Mar 2015 12:08:12 +0000 (12:08 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 20 Mar 2015 16:23:23 +0000 (17:23 +0100)
Fixes #14186

a positive HRESULT means it succeeded.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/audio_output/directsound.c

index 2a1a06d749cf0cc2a44e4ef2466f3d74af50fdcd..9b2536b05572f40514d6fffda28dcc08a59b969c 100644 (file)
@@ -148,8 +148,10 @@ static HRESULT TimeGet( aout_stream_sys_t *sys, mtime_t *delay )
     mtime_t size;
 
     hr = IDirectSoundBuffer_GetStatus( sys->p_dsbuffer, &status );
-    if(hr != DS_OK || !(status & DSBSTATUS_PLAYING))
-        return 1;
+    if( hr != DS_OK )
+        return hr;
+    if( !(status & DSBSTATUS_PLAYING) )
+        return DSERR_INVALIDCALL ;
 
     hr = IDirectSoundBuffer_GetCurrentPosition( sys->p_dsbuffer, &read, NULL );
     if( hr != DS_OK )
@@ -160,7 +162,7 @@ static HRESULT TimeGet( aout_stream_sys_t *sys, mtime_t *delay )
     /* GetCurrentPosition cannot be trusted if the return doesn't change
      * Just return an error */
     if( size ==  0 )
-        return 1;
+        return DSERR_GENERIC ;
     else if( size < 0 )
       size += DS_BUF_SIZE;