5

I am trying to create an OPUS based multicast server for an audio project that I am working on and it will be running on the O-Droid X (http://www.hardkernel.com/renewal_2011/products/prdt_info.php?g_code=g133999328931) for this project. At the moment I am unsure on where to start for creating and going about making a multicast server in linux or android using the OPUS codec. This is my first multicast server for audio support that I have done from scratch. If there are any pointers they would greatly be appreciated.

Also making it accessible through a web page and playable through that webpage would be an ideal situation so that a specific app on the client side would not be needed.

AMIC MING
  • 6,306
  • 6
  • 46
  • 62
Friendlyghost89
  • 247
  • 8
  • 19

2 Answers2

1

Apparently Icecast does a lot of what you're looking for. It's open source (GPL) and supports Opus streams using the Ogg container format, you could have a peek for some general software architecture ideas. My SoundWire Android app (with Win/Linux server) does Opus streaming with low latency but the network protocols are custom... I don't know any established open protocols that can do low latency (by my definition 1 second delay is not low latency).

My approach was to build a conventional network server that sets up a normal unicast UDP socket for each client. Avoid TCP if you want low latency, then you'll have to deal with the datagram nature of UDP in some way. With Opus the amount of data streamed per client is not excessive. I use multicast only for discovery (auto locate a server).

I suggest you start with some open source server code and adapt it for your needs, bring in Opus which is very easy to integrate, choose a container format such as Ogg if it's suitable (search for Ogg Opus). If you want browser compatibility then you'll more or less be implementing part of a web server (HTTP etc.) and will have to give up on your low latency goals.

Georgie
  • 2,448
  • 2
  • 17
  • 13
  • Is there any pointers that you could give me for setting up/ creating low latency network protocols? This is new territory for me... – Friendlyghost89 Mar 06 '13 at 03:55
  • 2
    Just some general ideas... keep buffer sizes as small as possible, avoid bloated libraries, don't use TCP, write your code to be deterministic (consistent behaviour), tune your thread priorities if possible, choose your platforms carefully (for example if choosing between C++ and Java, choose C++). In short, think lean & mean. Finally realize that there are two huge factors which mean you will never fully reach your goal: IP networking was not designed for predictability or low latency, and neither was the non-realtime OS your code is running on. – Georgie Mar 15 '13 at 02:56
0

As a general note, pending a reply to my comment: You will be disappointed to learn that multicast is pretty much useless. Outside of some unusual configurations which you will probably not encounter in the real world, multicast doesn't work over the Internet, as most routers are not configured to pass it. It's really only usable over local networks.

As far as making it accessible through a web page, you're pretty much out of luck. There is no native browser support for multicast, nor is support widespread for OPUS, and most of the standard methods of extending the browser's capabilities (e.g, Javascript and Flash) can't really help you much either. You might be able to implement it in a Java applet, but the number of user agents with working Java installations is rapidly shrinking (particularly with the recent Java exploit), and the resulting applet may end up requiring elevated privileges to use multicast anyway.

  • OPUS is supported with Firefox as of the 15.0 beta (https://hacks.mozilla.org/2012/07/firefox-beta-15-supports-the-new-opus-audio-format/)???? The reason for the possible multicast is that this will be used on a local network only and may be sent to many users and we are wanting to minimize any and all latency as much as possible.... This is for an audio application where latency control is very important.... we are starting with a browser implement then moving to an application if necessary. – Friendlyghost89 Jan 15 '13 at 03:35
  • 1
    Hm, wasn't aware of Opus being in Mozilla -- there's still no way to get multicast, though. That being said, I would advise **strongly** against trying for a browser implementation. Based on your needs, you're best off going straight for a standalone application. –  Jan 15 '13 at 03:39
  • Is there anything that could help aid in the server side of the setup that you could aid in? this is my first custom audio server setup... – Friendlyghost89 Jan 15 '13 at 03:44