Thursday, June 11, 2009

Real Time Voice Streaming for Google Android - Part 2 [Technical Details]

To stream voice, fundamentally, we need the following components.
  • A method to obtain PCM audio from the Mic and store it in an in-memory buffer.
  • A protocol suitable for transfer of real time data - RTP in other words.
  • Some kind of signaling protocol to negotiate the call. (Eg: SIP, XMPP/Jingle).
  • A codec to optimize the data transfer format. (Eg: Speex).
As far as the Google Android platform is considered, until recently (Android SDK 1.1 and lower) did not have the first capability. Android 1.5 still does not have an RTP stack, but I have ported a small but functional Open Source RTP stack to the platform. As for signalling, SIP and XMPP/Jingle, I feel have too much overhead. Since both peers will be utilizing my client, a stripped down negotiation protocol would be more efficient. This is where XMPP comes in. As you may know, XMPP is XML based and is widely used. Hence, we can build a small but fast call negotiation protocol over XMPP, given that the parties are logged in via their Jabber accounts.
One may think that this won't inter-operate with existing infrastructures. This is true. To have that capability would translate into unnecessary complexity at this stage. Integration with existing systems is future work as of now. :-)



Another point is that trasmitting raw PCM over the internet is not a very efficient design choice. For this, we need some kind of Codec that will provide us with compression, decompression etc. the Speex codec is Open source and available in Java as jSpeex. It is simple to use.




I will be approaching this project in the following manner.

1. Write PURE java code and test my ideas and algorithms on a Java applet.
2. Port it to the Android platform.


8 comments:

  1. Very interesting ! I intended to build a SIP UA on my spare time (see the start at http://jeanderuelle.blogspot.com/2008/10/jain-sip-is-working-on-top-of-android.html) and I wold definitely be interested to help out when you want to inter-operate later on with existing infrastructures.
    Once you got an open source project out, let me know

    Jean

    ReplyDelete
  2. i would be totally interested in what you guys come up with. i will be needing this, if you can get it to work. i would love to help out, too. is there by any chance you could give me your email, i am talking to the ripper

    ReplyDelete
  3. i can help you port this to android, once your applet is working.

    ReplyDelete
  4. hey Kevin, yes I would like to collaborate with you. This blog is not that up to date nowadays. I have made lots of progress on the system. Once I get rid of a few problems, I will be able to have a working prototype in less than a week's time. This is my email address : earlenceferns@gmail.com

    ReplyDelete
  5. friends, I will want to follow your progress closely. I am in need of a way to transmit Android voice data in realtime from mic to a server over cellular. I can use whatever protocol is most efficient for that upload, it need not follow any existing standard. I have a fun application idea for this. Just need to minimize delays of blasting the voice data across and for playback. Regards, gunnar@medial.com

    ReplyDelete
  6. yes, am working on it. I have several techniques for efficient transfer of voice, but I my progress is limited due to unavailability of devices

    ReplyDelete
  7. hello can u please explain how speex is work and what step i uses for transferring real time audio to server with speex conversion.

    ReplyDelete