05-21-2010 07:47 AM
I am trying to stream audio packets captured by the blackberry microphone to my server.
To do so, I am using a player and a record control with a ByteArrayOutputStream but instead of recording the stream in a file, I am reading the buffer continuously and send the packets over the network. It works fine but I get a 500ms delay at the receiver side.
The problem is that the recordControl only write chunks of 1024 byte at once (which is about 600ms of voice), and thus streaming of the voice is delayed by half a second.
DO you know if I can have the recordControl write smaller chunks? Is there another library that I can use which does not have that defect?
THanks for your help.
05-21-2010 10:22 AM
I don't really have an answer for you, but I do have a question.
How (on the server end) are you translating packets and streaming them...I always wondered how this was done.
Also what format are you streaming AMR ?
05-21-2010 10:29 AM
I am sending datagram from bb which consists of AMR packets with a proprietary header. On the server side, I have an open UDP socket and I am parsing the packets and then decoding them with AMR codec.
Does it answer your question?
05-21-2010 11:28 AM
Try the following method in RecordControl class
public int setRecordSizeLimit(int size)
When recording is in progress,
commit will be called implicitly in the following cases:
Once a record size limit has been set, it will remain so for future recordings until it is changed by another
Because of the underline reason, I would recommend to save the original limit somewhere, and save it. So you can revert it back to original limit after you are done.
Let me know if it works out.
06-25-2010 10:31 AM
I left this problem aside for a moment but I tried again today and I can confirm that in my implementation it does not work.
I can set the size to let's say 384 and I do get that number into my buffer instead of the usual 1024. However, I can not continue streaming afterwards. The recorder stops and I can not restart it even if I restart the entire player. I got the event "Device Unavailable".
Did anyone else manage to stream using a recordControl?