Hello, On 8/22/06, jzhang <[EMAIL PROTECTED]> wrote: > In the sipXtapi's doc, it said that micHook and spkHook functions can't > block. "This > callback proc must *NOT* block and must return data quickly. Additionally, > the method > should not call any blocking function (i.e. IO operations, malloc, new, > etc)." . Why? This is bacause callbacks are called from media processing thread. If it will be blocked, then you'll hear gaps in the audio. There could be other artifcats too..
> Then how can I program to hand this situation: I want to receive voice data > from a socket > and use them in the MicHook function , while I also want to get voice data > from the SpkHook > function and send them to another socket.It seems recvfrom and sendto are > block functions. You should do all blocking operations in other threads. E.g. you may have one thread for incoming socket and one for outgoing. Then, you may use message queue to send and receive data to/from this threads. You could use OsMsgQ or any other realization. But don't forget to use non-blocking send()/recv() functions. Look into MprFromMic and MprToSpkr for example of such queue usage. Regards, Alexander Chemeris. _______________________________________________ sipxtapi-dev mailing list [email protected] List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/
