Closed Bug 1424168 Opened 7 years ago Closed 7 years ago

[Fennec][HLS] Exoplayer causes high memory usage on some websites.

Categories

(Firefox for Android Graveyard :: Audio/Video, enhancement, P2)

enhancement

Tracking

(firefox59 fixed)

RESOLVED FIXED
Firefox 59
Tracking Status
firefox59 --- fixed

People

(Reporter: JamesCheng, Assigned: JamesCheng)

References

Details

Attachments

(1 file)

I found this site

https://www.buzzfeed.com/news?utm_term=.fgG1PqnqB#.iuLzMwjwq

will make Exoplayer consume memory a lot to 80% on my Google Pixel.

That means it will make OOO in some lower level devices.

I will try to find if anything that we can improve.
Priority: P2 → --
Reword comment 0

s/OOO/OOM

In addition, I can use Android Device Monitor to watch the memory consumption of the Fennec.
12-08 14:46:01.180 12714 12738 I Gecko   : [Main Thread]: D/nsMediaElement 0xb67c5000 SuspendOrResumeElement(pause=0, suspendEvents=0) hidden=0
12-08 14:46:01.215 12714 12738 I Gecko   : [Main Thread]: D/nsMediaElement 0xbcbb0000 SuspendOrResumeElement(pause=0, suspendEvents=0) hidden=0
12-08 14:46:01.251 12714 12738 I Gecko   : [Main Thread]: D/nsMediaElement 0xbcba7800 SuspendOrResumeElement(pause=0, suspendEvents=0) hidden=0
12-08 14:46:01.281 12714 12738 I Gecko   : [Main Thread]: D/nsMediaElement 0xbcced000 SuspendOrResumeElement(pause=0, suspendEvents=0) hidden=0
12-08 14:46:01.298 12714 12738 I Gecko   : [Main Thread]: D/nsMediaElement 0xbccee000 SuspendOrResumeElement(pause=0, suspendEvents=0) hidden=0
12-08 14:46:01.315 12714 12738 I Gecko   : [Main Thread]: D/nsMediaElement 0xbccee800 SuspendOrResumeElement(pause=0, suspendEvents=0) hidden=0


The site creates 6 media element without playing it so that each mediaelemnt will bind a Exoplayer instance which may consume memory...
We use DefaultLoadControl [1] as the load controller in our GeckoHlsPlayer. In theory, it attempts to buffer 30000 ms data at most.
So using ExoPlayerFactory.newInstance [2] with a customized load controller may help.


[1] https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/thirdparty/java/com/google/android/exoplayer2/DefaultLoadControl.java#34-39
[2] https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/thirdparty/java/com/google/android/exoplayer2/ExoPlayerFactory.java#169-170
Attachment #8936460 - Flags: review?(kikuo)
Comment on attachment 8936460 [details]
Bug 1424168 - Reduce the Exoplayer buffer size to avoid OOM.

https://reviewboard.mozilla.org/r/207178/#review213044

::: mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java:571
(Diff revision 1)
> +        // See Bug 1424168.
> +        DefaultLoadControl dlc =
> +            new DefaultLoadControl(
> +                new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE),
> +                DefaultLoadControl.DEFAULT_MIN_BUFFER_MS,
> +                15000, /*this value can eliminate the memory usage immensely by experiment*/

I'd suggest using "DEFAULT_MAX_BUFFER_MS / 2" or DEFAULT_MIN_BUFFER_MS here directly, so that we can have a clear sense of what's happening here which is you're setting the max buffer ms to the min buffer ms.

And what if the "max buffer ms" is accidentaly set to a value smaller than the "min buffer ms" ?

should we check for that ?
Priority: -- → P2
Comment on attachment 8936460 [details]
Bug 1424168 - Reduce the Exoplayer buffer size to avoid OOM.

https://reviewboard.mozilla.org/r/207178/#review213058
Attachment #8936460 - Flags: review?(kikuo) → review+
Pushed by jacheng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0d60eea85ffd
Reduce the Exoplayer buffer size to avoid OOM. r=kikuo
https://hg.mozilla.org/mozilla-central/rev/0d60eea85ffd
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
Here you'll get Greatest Funny Text Memes, distinguished by popularity as per overall sites on the Web. Check out our Grumpy Cat, Hilarious, Funniest, Dog, Internet memes and much more.

https://textmemes.com/
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: