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
Contributor
Posts: 17
Registered: ‎08-01-2012
My Device: Blackberry 10 Alpha Device
My Carrier: None

Priority of background task

Is there any documentation regarding how thread priority/policy is affected of the application when it is sent to background.

 

E.g. application declares 'run_when_backgrounded', it is playing some audio content by decoding MP3 file and using sub-set of snd_pcm_... functions from QNX audio API. snd_pcm_write() is used in blocking manner, with total number of fragments (frags) around 16 (around 250 ms latency). The audio decoding phase is fast enough.

 

Whe application stays in the foreground in its own UI then audio playback is stable but once it is sent to background by swiping from the bottom of screen and when some other application is opened, like internet browser then audio starts sluttering.

 

The interesting thing is that SND_PCM_STATUS_UNDERRUN is not reported, it means that audio core of application is able to deliver data on time.

 

The audio rendering core is running under highest thread priority (63).

 

It looks like when backgounded the priority of application processes is changed to something else (to make UI and other front apps more responsive?) that is lower than usual and application does not receive enough CPU time. If SND_PCM_STATUS_UNDERRUN is not set then does it mean that audio core of QNX is suffering from priority degradation of background task?

 

Are there any tricks to improve situation?

 

Best regards,

Dmitry.

Contributor
Posts: 17
Registered: ‎08-01-2012
My Device: Blackberry 10 Alpha Device
My Carrier: None

Re: Priority of background task

An update to the problem:

 

If thread priority is not modified, or at least is not set to higher than normal then sluttering problem disappears.