[2/2] winepulse.drv: Silence the correct buffer.

Andrew Eikum aeikum at codeweavers.com
Mon Nov 2 19:04:40 CST 2015


On Tue, Nov 03, 2015 at 01:26:16AM +0100, Sebastian Lackner wrote:
> Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
> ---
> 
> It seems this was a mistake while rebasing. Please note that different
> buffers are used (This->tmp_buffer vs This->locked_ptr).
> 

Good eye. I already have a patch to fix this in the sequence, unsent
yet. My version adds a silence_buffer() utility method to avoid the
duplicate check for the format. It'll be in the next wave.

Andrew

>  dlls/winepulse.drv/mmdevdrv.c |   17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
> index 4863bb3..47e9b0d 100644
> --- a/dlls/winepulse.drv/mmdevdrv.c
> +++ b/dlls/winepulse.drv/mmdevdrv.c
> @@ -1738,18 +1738,17 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
>          return AUDCLNT_E_INVALID_SIZE;
>      }
>  
> -    if (flags & AUDCLNT_BUFFERFLAGS_SILENT) {
> -        if (This->ss.format == PA_SAMPLE_U8)
> -            memset(This->tmp_buffer, 128, written_bytes);
> -        else
> -            memset(This->tmp_buffer, 0, written_bytes);
> -    }
> -
>      This->locked = 0;
> -    if (This->locked_ptr)
> +    if (This->locked_ptr) {
> +        if (flags & AUDCLNT_BUFFERFLAGS_SILENT)
> +            memset(This->locked_ptr, This->ss.format == PA_SAMPLE_U8 ? 0x80 : 0, written_bytes);
>          pa_stream_write(This->stream, This->locked_ptr, written_bytes, NULL, 0, PA_SEEK_RELATIVE);
> -    else
> +    } else {
> +        if (flags & AUDCLNT_BUFFERFLAGS_SILENT)
> +            memset(This->tmp_buffer, This->ss.format == PA_SAMPLE_U8 ? 0x80 : 0, written_bytes);
>          pa_stream_write(This->stream, This->tmp_buffer, written_bytes, pulse_free_noop, 0, PA_SEEK_RELATIVE);
> +    }
> +
>      This->pad += written_bytes;
>      This->locked_ptr = NULL;
>      TRACE("Released %u, pad %zu\n", written_frames, This->pad / pa_frame_size(&This->ss));
> -- 
> 2.6.2



More information about the wine-devel mailing list