Hi,
Thanks to
your help, I wrote a proof-of-concept of push-to-talk feature for Batphone.
It is for real-time communication only (it is not the "voice mail" you have planned to implement).
I integrated it quickly-and-dirtily in the peer list (Contacts > "List phones on the mesh"):
http://dl.rom1v.com/batphone-walkie-talkie.pngJust select the recipients with the checkbox I added and push "TALK" button (yes, this button is awful).
On the screenshot, the first and third peers are selected.
The feature is available here:
https://github.com/rom1v/batphone/commits/walkietalkieIt depends on MDP sockets feature:
https://github.com/servalproject/batphone/pull/51https://github.com/servalproject/serval-dna/pull/53So you have to pull
walkietalkie branch on
batphone and
mdpsock on
serval-dna.
All batphones must be in
PeerList activity for receving/sending audio packets
(it is very easy to listen from any activity, as walkie-talkie is an Android service, but for the moment I only start it in PeerList.onResume() and stop it in PeerList.onPause()).
Walkie-talkie implementation is full-java.
Audio is captured at 8kHz and encoded in A-Law (8 bits).
It is packetized in a very simple protocol (10 bits for headers: 2 for packet sequence id, 4 for timestamp, 4 for source id).
Each packet is sent
n times if there are
n recipients.
The receiver is able to receive multiple audio streams and mix them together.
It uses a constant network cache of 100ms (
AudioReceiver.DELAY_IN_MS).
There is no echo canceller, so you should test with headsets.
On client mode, I tested with 7 phones connected to a 8th configured as AP (each person having a headset). It worked very well.
On ad-hoc mode, I had some independant problems:
- not all my phones work in ad-hoc mode ;
- some working phones don't detect each other (see
https://github.com/servalproject/serval-dna/issues/52#issuecomment-14559387).
I successfully tested with 3 phones in ad-hoc mode.
If you are interested in adding such a push-to-talk feature in Batphone, I think there is some work remaining: factorizing some parts with 1-to-1 communications for removing redundancy, maybe moving some code to native part (I read somewhere you wanted to do that for rhizome), using a better codec like
opus or
speex (for the moment it takes 64Kbps per recipient, which is huge), using a standard protocol like
RTP, provide a better UI than my PeerList-hack...
Feedbacks are welcome.