Re: CFMessagePort, audio sampling and sending UDP packets
Re: CFMessagePort, audio sampling and sending UDP packets
- Subject: Re: CFMessagePort, audio sampling and sending UDP packets
- From: Joel Reymont <email@hidden>
- Date: Fri, 13 Feb 2009 22:54:54 +0000
On Feb 13, 2009, at 10:36 PM, Mark Pauley wrote:
Why not just use a CFRunLoopSource?
I thought CFMessagePort _was_ a run loop source.
All you need to do is wake the consumer up right?
Correct.
Schedule the CFRunLoopSource on your main thread, also whenever you
signal it make sure to call CFRunLoopWakeUp on the main thread after
signaling the source,
That's my question, basically. What should I use as a run loop source
to wake up the consumer? I just want to say "hey, there's data in the
ring buffer, grab it!".
Alternatively, you could even just go with a simple semaphore
initialized to 0 if you could move your consumer thread to a non-
main thread.
I thought of using a semaphore but all I need to do is invoke 'sendto'
and the GUI in my case is not doing anything. I'm not convinced
another thread is the ideal solution here. I may be worrying too much,
though, since there's the main thread and the internal CFSocket thread
for UDP receive. What's another thread?
My main concern is making sure the audio callback can proceed with
sampling, otherwise the audio quality may suffer. I figure I'll be
solid if the main thread can take care of UDP sendto and the run loop
seems like _the_ way to notify it.
I just don't know what source to use to notify the run loop. A timer
doesn't fit so it seems like I'm left with a CFMachPort and
CFMessagePort. What am I missing?
Thanks, Joel
---
http://tinyco.de
--- Mac & iPhone
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden