[vlc-devel] [PATCH] auhal: fail in render callbacks if bytesToCopy is <= 0
David Fuhrmann
david.fuhrmann at gmail.com
Mon Jan 6 15:17:13 CET 2014
Am 31.12.2013 um 11:21 schrieb david.fuhrmann at gmail.com:
> From: David Fuhrmann <david.fuhrmann at googlemail.com>
>
> This should not happen in the current implementation.
> ---
> modules/audio_output/auhal.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
> index dcb59f3..cad7e37 100644
> --- a/modules/audio_output/auhal.c
> +++ b/modules/audio_output/auhal.c
> @@ -1446,12 +1446,11 @@ static OSStatus RenderCallbackAnalog(vlc_object_t *p_obj,
> memset(targetBuffer, 0, bytesRequested);
> } else {
> int32_t bytesToCopy = __MIN(bytesRequested, availableBytes);
> + assert(bytesToCopy > 0);
>
> - if (likely(bytesToCopy > 0)) {
> - memcpy(targetBuffer, buffer, bytesToCopy);
> - TPCircularBufferConsume(&p_sys->circular_buffer, bytesToCopy);
> - ioData->mBuffers[0].mDataByteSize = bytesToCopy;
> - }
> + memcpy(targetBuffer, buffer, bytesToCopy);
> + TPCircularBufferConsume(&p_sys->circular_buffer, bytesToCopy);
> + ioData->mBuffers[0].mDataByteSize = bytesToCopy;
> }
>
> vlc_cond_signal(&p_sys->cond);
> @@ -1494,6 +1493,7 @@ static OSStatus RenderCallbackSPDIF(AudioDeviceID inDevice,
> memset(targetBuffer, 0, bytesRequested);
> } else {
> int32_t bytesToCopy = __MIN(bytesRequested, availableBytes);
> + assert(bytesToCopy > 0);
>
> memcpy(targetBuffer, buffer, bytesToCopy);
> TPCircularBufferConsume(&p_sys->circular_buffer, bytesToCopy);
> --
> 1.8.3.4 (Apple Git-47)
>
Hi,
Felix, is it fine with you if I apply this patch at least in head?
With best regards,
David
More information about the vlc-devel
mailing list