[vlc-commits] audioqueue: don't avoid impossible case

Rafaël Carré git at videolan.org
Mon Feb 4 17:13:55 CET 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Feb  4 17:13:17 2013 +0100| [2515960dedfa72321b4a69d3cc8153aa599a172b] | committer: Rafaël Carré

audioqueue: don't avoid impossible case

Play() should always be fed with valid block_t *

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2515960dedfa72321b4a69d3cc8153aa599a172b
---

 modules/audio_output/audioqueue.c |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/modules/audio_output/audioqueue.c b/modules/audio_output/audioqueue.c
index 897c19d..108b122 100644
--- a/modules/audio_output/audioqueue.c
+++ b/modules/audio_output/audioqueue.c
@@ -156,25 +156,23 @@ static void Stop (audio_output_t *p_aout)
 
 static void Play (audio_output_t *p_aout, block_t *p_block)
 {
-    if (p_block != NULL) {
-        AudioQueueBufferRef inBuffer = NULL;
-        OSStatus status;
-
-        status = AudioQueueAllocateBuffer(p_aout->sys->audioQueue, p_block->i_buffer, &inBuffer);
-        if (status != noErr) {
-            msg_Err(p_aout, "buffer alloction failed (%li)", status);
-            return;
-        }
-
-        memcpy(inBuffer->mAudioData, p_block->p_buffer, p_block->i_buffer);
-        inBuffer->mAudioDataByteSize = p_block->i_buffer;
-        p_aout->sys->i_played_length += p_block->i_length;
-        block_Release(p_block);
-
-        status = AudioQueueEnqueueBuffer(p_aout->sys->audioQueue, inBuffer, 0, NULL);
-        if (status != noErr)
-            msg_Err(p_aout, "enqueuing buffer failed (%li)", status);
+    AudioQueueBufferRef inBuffer = NULL;
+    OSStatus status;
+
+    status = AudioQueueAllocateBuffer(p_aout->sys->audioQueue, p_block->i_buffer, &inBuffer);
+    if (status != noErr) {
+        msg_Err(p_aout, "buffer alloction failed (%li)", status);
+        return;
     }
+
+    memcpy(inBuffer->mAudioData, p_block->p_buffer, p_block->i_buffer);
+    inBuffer->mAudioDataByteSize = p_block->i_buffer;
+    p_aout->sys->i_played_length += p_block->i_length;
+    block_Release(p_block);
+
+    status = AudioQueueEnqueueBuffer(p_aout->sys->audioQueue, inBuffer, 0, NULL);
+    if (status != noErr)
+        msg_Err(p_aout, "enqueuing buffer failed (%li)", status);
 }
 
 void AudioQueueCallback(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) {



More information about the vlc-commits mailing list