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

Native Development

Reply
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Audio buffer underruns with 10.9.9.339


peter9477 wrote:
This was only after I bumped it to the maximum priority, of 63. I had it at 52 for awhile and it wasn't long before I heard one of the glitches.


Please do not do this!  Setting the priority this high can potentially starve out interrupt handlers.  In the words of the audio lead: "bad things will happen"

 

That being said.. please send me your bar file with prio set to like ~20, Peter.  I will run it by the audio guys today if possible.

Please use plain text.
New Developer
jbeach42
Posts: 63
Registered: ‎10-27-2010
My Device: 9900 and PlayBook

Re: Audio buffer underruns with 10.9.9.339

I'm very interested in a solution on this thread as I too am experiencing similar issues with an app that generates dynamic sin waves.  When the device goes into sleep mode, I get all sorts of audio choppiness.

The problem happens with SDL or libasound.

-----------------------------------------------------------------------------
Apps:Beats Brainwave Entrainment - Awesome Timer - StarSlide - Save Santa
@jamiebeach
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Audio buffer underruns with 10.9.9.339

jbeach42, I've got an update for you then.

Once the 10.0.10.672 update came out for my Z10, I've experienced none of the glitches I referred to earlier.

I've been testing both with the original (released) version of the app, which used the default priority level (10), and with a development version which has no relevant changes other than a boost to priority 30.

I suspect that update fixed some major problems down in the audio system somewhere, and I've got nearly enough flawless runtime to consider the issue closed for me.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Audio buffer underruns with 10.9.9.339

Also, do you get the choppiness in sleep mode, or any time your app is not fullscreen? When our apps go into the "background" partition, they are basically put together into a group with reduced CPU quota.

If your app's CPU requirements exceed whatever the limit is (maybe it's about 25%, plus or minus, not sure) then you'd definitely get some glitching.

You can experiment with this by injection some artificial delays into some of the code, to reduce its responsiveness still further. If adding even a small bit of delay makes a difference, you're at best in a borderline situation.

Go the other way as well, if you can: reduce the number of channels you're generating in parallel, or generating at a lower sampling rate, and see if the problem improves or vanishes. Again, that would point to excessive CPU usage.

Sadly we have no way to directly measure our CPU usage (as a %) right now, though you may be able to make use of data from "pidin". Type "use pidin" at the command line (when SSHed into the device) to learn more.

If you run "pidin" with no args, you can find the PID of your devmode app. Use that in a command like "pidin -p 12345678 ttimes" to see info about individual thread times, or "pidin -p 12345678 times" to see overall times for your app. Some background here https://developer.blackberry.com/native/reference/bb10/com.qnx.doc.neutrino.utilities/topic/p/pidin....

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
New Developer
jbeach42
Posts: 63
Registered: ‎10-27-2010
My Device: 9900 and PlayBook

Re: Audio buffer underruns with 10.9.9.339

@peter9477 - thanks for that great info!

 

I'm just testing with the dev alpha still.  Haven't given it up yet :smileywink:.  I'll get someone with a real z10 to try it out with the latest OS update to see what happens.

 

The problem doesn't happen only in sleep mode - it happens whenever I minimize the app (although not necessarily when the app is minimized) or bring it back to full screen.  The problem is definitely exagerated when in sleep mode though but isn't consistent at all.  

 

I've changed to use a fast sin approximation and decreased the sample rate to 11khz and it's still there.  I've done as much optimization as I possibly can (or at least to my knowledge) so perhaps my next step is getting it tested on an actual z10 with the latest update.

 

I'm going to take a look at pidin when I get a chance.

 

Again, thanks for the info.

 

-----------------------------------------------------------------------------
Apps:Beats Brainwave Entrainment - Awesome Timer - StarSlide - Save Santa
@jamiebeach
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Audio buffer underruns with 10.9.9.339

Feel free to send me a signed .bar and I can try it out on my Z10. I recognize the sorts of glitches that you're describing, I think, so I may be in a good position to give you feedback on that, not to mention (with luck) letting you know that it's cleared up in 10.0.10.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: Audio buffer underruns with 10.9.9.339

if you want to send me the bar file, I can have the audio guys take a look at it.

Please use plain text.