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

Steve Lhomme robux4 at videolabs.io
Fri Mar 20 17:16:30 CET 2015


On Fri, Mar 20, 2015 at 4:12 PM, Jean-Baptiste Kempf <jb at videolan.org> wrote:
> On 19 Mar, Steve Lhomme wrote :
>> a positive HRESULT means it succeeded.
>
>>      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 ;
>
> Aren't those return values positive too?

No, they are regular DirectSound errors, respecting the HRESULT nomenclature
https://msdn.microsoft.com/en-us/library/windows/desktop/ee416776%28v=vs.85%29.aspx

Some interresting info on HRESULT: http://en.wikipedia.org/wiki/HRESULT

>>      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;
>>
>> --
>> 2.3.2
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>
> --
> With my kindest regards,
>
> --
> Jean-Baptiste Kempf
> http://www.jbkempf.com/ - +33 672 704 734
> Sent from my Electronic Device
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list