[vlc-commits] auhal: fail in render callbacks if bytesToCopy is <= 0
David Fuhrmann
git at videolan.org
Tue Jan 7 09:50:16 CET 2014
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Tue Dec 31 11:17:08 2013 +0100| [28102b7cb60dc9338a98bc385379e8691c129eba] | committer: David Fuhrmann
auhal: fail in render callbacks if bytesToCopy is <= 0
This should not happen in the current implementation.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=28102b7cb60dc9338a98bc385379e8691c129eba
---
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);
More information about the vlc-commits
mailing list