[vlc-commits] directsound: fix TimeGet returning a positive value on error

Steve Lhomme git at videolan.org
Wed Mar 25 15:17:50 CET 2015


vlc/vlc-2.2 | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Mar 19 12:08:12 2015 +0000| [69143b2003bb86a83521385ce37ae0120963ee00] | committer: Jean-Baptiste Kempf

directsound: fix TimeGet returning a positive value on error

Fixes #14186

a positive HRESULT means it succeeded.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 936279b55ad908e031d450d377afa8e09feea296)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/audio_output/directsound.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c
index 480089b..88326d0 100644
--- a/modules/audio_output/directsound.c
+++ b/modules/audio_output/directsound.c
@@ -147,8 +147,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 )
@@ -159,7 +161,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;
 



More information about the vlc-commits mailing list