]> git.sesse.net Git - vlc/commitdiff
audioqueue: fixed potential TimeGet issue
authorRafaël Carré <funman@videolan.org>
Mon, 4 Feb 2013 18:35:23 +0000 (19:35 +0100)
committerFelix Paul Kühne <fkuehne@videolan.org>
Mon, 4 Feb 2013 18:35:23 +0000 (19:35 +0100)
Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
modules/audio_output/audioqueue.c

index 108b122ae9ebd46070a25d4c40992e8e61158370..59ebcf78fe15103bc6026b94b486e59c2c772360 100644 (file)
@@ -167,12 +167,14 @@ static void Play (audio_output_t *p_aout, block_t *p_block)
 
     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)
+    if (status == noErr)
+        p_aout->sys->i_played_length += p_block->i_length;
+    else
         msg_Err(p_aout, "enqueuing buffer failed (%li)", status);
+
+    block_Release(p_block);
 }
 
 void AudioQueueCallback(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) {