Commit 69143b20 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

directsound: fix TimeGet returning a positive value on error

Fixes #14186

a positive HRESULT means it succeeded.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 936279b55ad908e031d450d377afa8e09feea296)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent b88dbb4d
...@@ -147,8 +147,10 @@ static HRESULT TimeGet( aout_stream_sys_t *sys, mtime_t *delay ) ...@@ -147,8 +147,10 @@ static HRESULT TimeGet( aout_stream_sys_t *sys, mtime_t *delay )
mtime_t size; mtime_t size;
hr = IDirectSoundBuffer_GetStatus( sys->p_dsbuffer, &status ); hr = IDirectSoundBuffer_GetStatus( sys->p_dsbuffer, &status );
if(hr != DS_OK || !(status & DSBSTATUS_PLAYING)) if( hr != DS_OK )
return 1; return hr;
if( !(status & DSBSTATUS_PLAYING) )
return DSERR_INVALIDCALL ;
hr = IDirectSoundBuffer_GetCurrentPosition( sys->p_dsbuffer, &read, NULL ); hr = IDirectSoundBuffer_GetCurrentPosition( sys->p_dsbuffer, &read, NULL );
if( hr != DS_OK ) if( hr != DS_OK )
...@@ -159,7 +161,7 @@ static HRESULT TimeGet( aout_stream_sys_t *sys, mtime_t *delay ) ...@@ -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 /* GetCurrentPosition cannot be trusted if the return doesn't change
* Just return an error */ * Just return an error */
if( size == 0 ) if( size == 0 )
return 1; return DSERR_GENERIC ;
else if( size < 0 ) else if( size < 0 )
size += DS_BUF_SIZE; size += DS_BUF_SIZE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment