Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 402
Registered: ‎11-26-2010
My Device: Torch

Re: MMAPI sound Player overactive memory allocation

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.

----------------------------------------------------------------------
Press the button to give kudos if I helped you :smileyhappy:
Developer
Posts: 101
Registered: ‎12-10-2009
My Device: styile 9670
My Carrier: SingTel

Re: MMAPI sound Player overactive memory allocation

@BVP

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?

Mobile Application Advisor
Developer
Posts: 402
Registered: ‎11-26-2010
My Device: Torch

Re: MMAPI sound Player overactive memory allocation

[ Edited ]

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?

 

Thanks.

----------------------------------------------------------------------
Press the button to give kudos if I helped you :smileyhappy:
Retired
Retired
Posts: 150
Registered: ‎10-19-2010
My Device: Not Specified
My Carrier: Rogers

Re: MMAPI sound Player overactive memory allocation

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 :smileysad:

Developer
Posts: 193
Registered: ‎02-27-2009
My Device: Not Specified

Re: MMAPI sound Player overactive memory allocation

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.

Developer
Posts: 101
Registered: ‎12-10-2009
My Device: styile 9670
My Carrier: SingTel

Re: MMAPI sound Player overactive memory allocation

Blackberry amrnb encoder sometimes generates mod 15 type frame.The frame size is 1 byte and value is:smileysad:byte)0x7c 

how to get frame type number from this byte value :

(0x7c>>3)&0x0F=15

 

so you can use this byte value as a frame value

Mobile Application Advisor
Developer
Posts: 101
Registered: ‎12-10-2009
My Device: styile 9670
My Carrier: SingTel

Re: MMAPI sound Player overactive memory allocation

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.

Mobile Application Advisor
Developer
Posts: 402
Registered: ‎11-26-2010
My Device: Torch

Re: MMAPI sound Player overactive memory allocation

@dynamicdhaka so you haven't found the solution too?

I also tried different approaches but I had no success.
----------------------------------------------------------------------
Press the button to give kudos if I helped you :smileyhappy:
Developer
Posts: 101
Registered: ‎12-10-2009
My Device: styile 9670
My Carrier: SingTel

Re: MMAPI sound Player overactive memory allocation

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.

Mobile Application Advisor
Developer
Posts: 402
Registered: ‎11-26-2010
My Device: Torch

Re: MMAPI sound Player overactive memory allocation

@dynamicdhaka 

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. 

----------------------------------------------------------------------
Press the button to give kudos if I helped you :smileyhappy: