Closed Bug 871431 Opened 6 years ago Closed 6 years ago

[A/V] Background music playback is jittered while browsing

Categories

(Firefox OS Graveyard :: General, defect, P1, major)

ARM
Gonk (Firefox OS)

Tracking

(blocking-b2g:leo+, firefox22 wontfix, firefox23 wontfix, firefox24 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 affected)

RESOLVED FIXED
1.1 QE2 (6jun)
blocking-b2g leo+
Tracking Status
firefox22 --- wontfix
firefox23 --- wontfix
firefox24 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- affected

People

(Reporter: leo.bugzilla.gecko, Assigned: mchen)

References

()

Details

(Whiteboard: [TD-26228] c=music, MiniWW)

Attachments

(1 file, 1 obsolete file)

Start music application -> play any mp3 file -> home button -> start browser -> visit any url -> zooming while it loads web page

Then BGM is jittered.
If you visit the page that has lot of media, it can easily reproduced.

Build ID : 20130503155504
Gaia : 5cbb19e4bb78a7ad879fbe4b9a841e1c35714f5c
Gecko : 950b402b6188bb2f3ce3176e620ed5249719d720
blocking-b2g: --- → leo?
Whiteboard: [TD-26228]
Target Milestone: --- → 1.1 QE2
Adding qawanted to add this to test plans - trying to listen to music while browsing the web on media-heavy sites.
blocking-b2g: leo? → leo+
Keywords: qawanted
There is jittering experienced when visiting any url and zoomed while the web page still loading. 
Also, the user is also unable to increase the volume when a headset is used for listening to songs. 

Reproduces 3/8 times on Leo 
Build ID: 20130510070207
Gecko: http://hg.mozilla.org/releases/mozilla-b2g18/rev/2aba3b5ac1c2
Gaia: fcaa90923894211c19b3544b5cb16eb0db5a6286
Keywords: qawanted
Priority: -- → P1
Summary: [A/V] BGM is jittered while browsing → [A/V] Background music is jittered while browsing
This is not related to the Video app so changing the component.

Deepa: you should probably report the headphone issue as a separate bug.

Leo: What does BGM mean?
Component: Gaia::Video → General
Summary: [A/V] Background music is jittered while browsing → [A/V] BGM is jittered while browsing
> Deepa: you should probably report the headphone issue as a separate bug.
David there is a bug on it already. https://bugzilla.mozilla.org/show_bug.cgi?id=870894
Summary: [A/V] BGM is jittered while browsing → [A/V] Background music playback is jittered while browsing
Whiteboard: [TD-26228] → [TD-26228] c=music
(In reply to David Flanagan [:djf] from comment #3)

> Leo: What does BGM mean?

Sorry, for confusing.
BGM means Back Ground Music.
(Start music application -> play any mp3 file -> home button)
According to my investigation, audio flinger cannot receive any audio buffer to be rendered.
If you check the log, you can find log line like below.
05-09 17:10:05.050 V/AudioFlinger(  893): getNextBuffer() no more data for track 4097 on thread 0x191f248

At that point, CPU usage is over 80% (B2G + plugin container)
Hi,

I found some info related to this issue.

  1. music app in background on playing will be on BACKGROUND_PERCEIVABLE priority.
  2. BACKGROUND_PERCEIVABLE priority will get nice value 10.
  3. B2G process and browser app is under foreground priority and nice value will be 0 & 1

It seems to that B2G process & browser are busy on rendering action and occupy much cpu slots, then the remaining cpu slot is not enough for music app even rendering may occupy 80% but their's high nice value take the cpu slot from music app when it trys to do decoding.

If I set music app to nice value 1 then this bug is gone.
> If I set music app to nice value 1 then this bug is gone.

What's the highest niceness value you can set the music app to without causing this bug?

We're faced with some hard trade-offs here, because if we increase the priority of the music app, we're decreasing the smoothness of scrolling and other operations in the foreground app.  But I'd be up for giving the music app more CPU.
(In reply to Justin Lebar [:jlebar] from comment #8)
> What's the highest niceness value you can set the music app to without
> causing this bug?
> 

After the testing, set background_perceivable to 7 can avoid this issue but 8.

Hi Leo,

May be you can have a test on your side? Thanks.

http://mxr.mozilla.org/mozilla-central/source/b2g/app/b2g.js#596
(In reply to Marco Chen [:mchen] from comment #9)
> After the testing, set background_perceivable to 7 can avoid this issue but
> 8.
> 
> Hi Leo,
> 
> May be you can have a test on your side? Thanks.
> 

When it's 8, I got some jittering 1~2 times for 15 minutes web surfing.
However the jittering is for a moment. So it doesn't bother me.
(In reply to leo.bugzilla.gecko from comment #10)
> (In reply to Marco Chen [:mchen] from comment #9)
> When it's 8, I got some jittering 1~2 times for 15 minutes web surfing.

Yes, the nice value 8 will still have jitter issue but 7 can avoid it at all on this test case.
Attached patch Modify_Nice_To_7 v1 (obsolete) — Splinter Review
Based on comment 8, the nice value 7 can avoid this issue so have a patch on this change.

Could you review it or any other suggestion?
Thanks.
Attachment #749715 - Flags: review?(justin.lebar+bug)
Assignee: nobody → mchen
Comment on attachment 749715 [details] [diff] [review]
Modify_Nice_To_7 v1

Okay, this sounds fine.
Attachment #749715 - Flags: review?(justin.lebar+bug) → review+
Add reviewer and approval for leo.
Attachment #750858 - Flags: review+
Keywords: checkin-needed
Attachment #749715 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/8e524063308f
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Bug Description:
  When user scrolls the screen on a big page then user will hear audio is jitter.

User Impact:
  When this bug is happened, it degrades user experience on music playback.

Side Effect:
  To raise the nice of background perceivable process may affect the performance of foreground process. But currently foreground's nice value (1) is still more bigger then background perceivable (7).
This is currently a leo+. This still stands as a wontfix unless this gets a tef+. If you want consideration for tef, please nom.

If it's possible to reproduce this on 1.01, then set this to affected. If we don't know, then we need to nom and set to ?.
Bug Description:
  When user scrolls the screen on a big page in the browser then user will hear audio played by music app in the background is jitter.

User Impact:
  When this bug is happened, it degrades user experience on music playback.

Side Effect:
  To raise the nice of background perceivable process may affect the performance of foreground process. But currently foreground's nice value (1) is still more bigger then background perceivable (7).
blocking-b2g: leo+ → tef?
Daniel - no strong opinion here, up to you.
Flags: needinfo?(dcoloma)
Not blocking, changing process priority at this stage seems to me very risky
blocking-b2g: tef? → leo+
Flags: needinfo?(dcoloma)
Whiteboard: [TD-26228] c=music → [TD-26228] c=music, MiniWW
Flags: in-moztrap?
Flags: in-moztrap? → in-moztrap+
You need to log in before you can comment on or make changes to this bug.