Commit 3aa6b1be authored by David Fuhrmann's avatar David Fuhrmann

auhal: check if render callback does not want data

Indeed this can happen rarely.
parent de2d8633
......@@ -1302,6 +1302,8 @@ static OSStatus RenderCallbackAnalog(vlc_object_t *p_obj,
int bytesRequested = ioData->mBuffers[0].mDataByteSize;
Float32 *targetBuffer = (Float32*)ioData->mBuffers[0].mData;
if (unlikely(bytesRequested == 0)) /* cannot be negative */
return noErr;
vlc_mutex_lock(&p_sys->lock);
/* Pull audio from buffer */
......@@ -1314,7 +1316,6 @@ static OSStatus RenderCallbackAnalog(vlc_object_t *p_obj,
memset(targetBuffer, 0, bytesRequested);
} else {
int32_t bytesToCopy = __MIN(bytesRequested, availableBytes);
assert(bytesToCopy > 0);
memcpy(targetBuffer, buffer, bytesToCopy);
TPCircularBufferConsume(&p_sys->circular_buffer, bytesToCopy);
......@@ -1349,6 +1350,8 @@ static OSStatus RenderCallbackSPDIF(AudioDeviceID inDevice,
int bytesRequested = outOutputData->mBuffers[p_sys->i_stream_index].mDataByteSize;
char *targetBuffer = outOutputData->mBuffers[p_sys->i_stream_index].mData;
if (unlikely(bytesRequested == 0)) /* cannot be negative */
return noErr;
vlc_mutex_lock(&p_sys->lock);
/* Pull audio from buffer */
......@@ -1361,7 +1364,6 @@ 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);
......
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