DirectSpeakerController audio delay

I’m using a directspeakercontroller object to send audio from the PC mic to a speaker connected to an IP camera (ie a modified VideoViewer2WayAudio sample). It works, but I’ve noticed that the longer you transmit for, the more audio delay there is. For example, if I do a transmitstart(), say hello, then transmitstop() the audio comes out of the speaker within a second. If I do a transmitstart(), wait a minute, then say hello, there is a significant delay before it comes out of the speaker.

It doesn’t seem to happen with the unmodified sample, so it must be something I’m doing, but I can’t pinpoint anything. The app isn’t doing anything else that would bog it down.

I have the experience that different cameras might behave very different, if you compare two implementations I hope you also use the same camera for the comparison. On that note I believe that the cameras setup of audio is important to how this works and might be a worth to look into as troubleshooting.

If same camera and same code.. One tought I have is that maybe if you run this all in one thread, maybe the UI thread, it might be the cause of not sending the data in the correct rate. Perhaps you can run this audio routines in its own thread.