Help with another network audio project

81 views
Skip to first unread message

Sam Johnson

unread,
Jan 4, 2022, 2:58:18 AM1/4/22
to SonoBus Users
Hi,

I'm currently working on a network audio project that uses configurable forward error correction and connection multihoming to hopefully allow reliable transmission of audio while keeping latency at a minimum.

I'm having some issues with the audio intermittently cutting-out on WiFi which I think may be due to the way I've written the code, not necessarily due to unreliable WiFi.

My question is, in SonoBus / AoO is all the audio processing including the Opus encode/decode done within the high-priority audio callback? Also is the networking code in a separate thread or also in the audio callback?

At the moment I'm doing almost everything outside of the audio callback, and all the audio callback is doing is pulling/pushing samples from a lock-free queue that the lower priority threads fill/empty while communicating with the network.

I was wondering if this could be the wrong approach, as these lower priority threads could get preempted and starve the audio callback of samples? At the same time I've read that you're not supposed to make syscalls like send/recv inside the audio callback.

My code is here if you're interested: https://github.com/sfjohnson/waterslide
Any help would be greatly appreciated!

Thanks,
Sam.

Jesse Chappell

unread,
Jan 7, 2022, 4:28:19 PM1/7/22
to Sam Johnson, SonoBus Users
In the current version of SonoBus the actual encode/decode of the
audio going to/from the network is actually happening in
network-related threads, and not the audio callback. It sounds like
what you have with the audio thread passing audio to/from lockfree
queues is the right thing.... you never want to do any actual network
I/O calls from the audio callback context.

That said, it's probably a good idea to have the network threads
operating at a higher than normal priority (and sonobus does that
too).

Jesse
> --
> You received this message because you are subscribed to the Google Groups "SonoBus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sonobus-user...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sonobus-users/c3b517e2-f874-49b6-9167-7e8bdf4f75adn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages