From 5b7327920b1500c33342c021e70136973972fbce Mon Sep 17 00:00:00 2001
From: Mad Fish <MadFishTheOne@gmail.com>
Date: Sun, 20 Jan 2013 16:37:30 +0100
Subject: [PATCH] ao_coreaudio: use 0 as timeout for CFRunLoopRunInMode

Handle all pending events and exit instead of waiting. When there are lots of
input events (for example, scrolling with trackpad), timeout can add up
to make a huge frame delay. In my tests, if I scroll fast enough, that loop
would never exit.
---
 audio/out/ao_coreaudio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c
index c7a6f92ea9..7993eac910 100644
--- a/audio/out/ao_coreaudio.c
+++ b/audio/out/ao_coreaudio.c
@@ -1104,7 +1104,7 @@ static int play(void* output_samples,int num_bytes,int flags)
     audio_resume();
 
     do {
-        exit_reason = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, true);
+        exit_reason = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);
     } while (exit_reason == kCFRunLoopRunHandledSource);
 
     return wrote;