06-14-2011 09:51 AM
Thanks @BVP - I will try it!
Another interesting thing I noticed is that if you start a player the first time the buffer has size about 30k(rough calculation) and if you stop it and start it again it has size about 90k(again rough calculation). When I restart the device again I see the same situation. I am not talking about entering into buffering mode for a second time with the same player but closing and opening a new player.
Can you confirm that or it is something in my code?I test on 2 devices - bold 9780(os6) and pearl9100(os5) and I believe that I create and close the players properly but who knows.
06-15-2011 03:18 AM
have you tested the scenario in os 5 or os 6 that if you send to meida player mod 15 type frame ,media player always skip this frame and start playing from next data frame?...or this is for os 7.0?
06-15-2011 08:08 AM - edited 06-15-2011 08:51 AM
Ok now the question is how to create these type 15 frames?
AFAIK the AMR file starts with the bytes corresponding to the symbols #!AMR\n
After that you have frames each being 32 bytes=1 byte header, 31 bytes audio.
The frame header has the following structure:
F | FT | Q | P | P |
F(1bit):If set to 1, indicates that this frame is followed by another speech frame in this payload; if set to 0, indicates that this frame is the last frame in this payload.
FT(4bits): Frame type. For our purposes we need FT=15 which means NO_DATA
Q(1bit): quality bit , 0 means that the frame is damaged, so I guess we need to put 1 here
P(1 bit): padding, it should be 0
So if this is correct type 15 frame should look something like this:
0 | 1111 | 1 | 0 | 0 or the value 62 in decimal
I have to be making some mistake because I still hear actual audio output.
In a doc I read it said that if the frame is type 15 no audio follow i.e the frame is 1 byte(only header) without 31 bytes audio after that. I tried both with and without the following 31 bytes and I still head audio output.
I also noticed that if I start a recording player it records with frame header with value 60 which in binary is
0 | 0111 | 1 | 0 | 0 - this is strange because 0111=14 which means SPEECH_LOST.
I must be making some mistake here. I am not familiar with the AMR codec that well. Can anyone help with this? How to create these frames with type 15? Or if I am creating them correctly why do I still hear audio output?
06-15-2011 10:35 AM
Sorry cwong15, you are right about the problem affecting both playback and recording, I stand corrected. I have confirmed the fix mentioned in the thread you linked addresses both as well... I wish I had better news for you. I will see if the fix can be applied to previous BlackBerry OS versions but I cannot make any promises here unfortunately since it depends on a lot of things that are beyond my control
06-15-2011 02:34 PM
I appreciate the communications, BVP. It may not be the answer I want to hear, but it is the answer I need to hear. Is it possible to reveal what OS versions are affected by the excessive debug statements? The JAVAAPI-1757 bug is not accessible to us mere mortals. Thank you.
06-16-2011 02:14 AM
Blackberry amrnb encoder sometimes generates mod 15 type frame.The frame size is 1 byte and value isbyte)0x7c
how to get frame type number from this byte value :
so you can use this byte value as a frame value
06-16-2011 02:19 AM
again i have applied no-data frame technique in os 6.0 device but the outcome which i have gotten is frustrated . I am getting voice after a delay which is created by no-data frame. so far amrnb decoder generates 320 bytes silence PCM data so Player does not skip this no-data frame chunk.
06-16-2011 03:27 AM
06-16-2011 04:18 AM
i have used another approach which i discuss in another thread "delay in os 6.0" .in os 6 the bufferinng lagging time is 500ms that means player must have always 500 ms data in player buffer. i have approach a way to maintian the buffer size using silence and real time data.
i just tried this way whether player buffer skip no-data frame or not . but it does not work .player recognize it as a silence frame and make silence 320 pcm data frame.
06-16-2011 09:16 AM
I tried the same approach as you did but I also hear some sound output.
Maybe we are not creating the frames correctly. Which structure of AMR frame are you using?
I am using the one described here http://tools.ietf.org/html/rfc3267#section-4.1 (page 17)
Maybe it would be better if @BVP explains how to apply the technique properly.