Closed Bug 1012516 Opened 10 years ago Closed 6 years ago

SpecialPowers.exactGC is very slow in content/media/test/manifest.js

Categories

(Core :: Audio/Video: Playback, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED INACTIVE

People

(Reporter: jwwang, Unassigned)

Details

I was trying enable media tests on B2G ICS Emulator Debug and found out chunk 6 (most of the media tests reside in) always ran over 2 hours and got killed.

https://tbpl.mozilla.org/php/getParsedLog.php?id=39925291&tree=Try&full=1#error0

After adding some logs, I found out SpecialPowers.exactGC could be the problem which could take up to 10s for each run. Since we run SpecialPowers.exactGC after finishing each token, the test time would be proportional to the number of tokens in the test. For example, test_media_selection.html which has over 90 tokens took 1025454 ms to finish.

Search through the logs for |nextTest, before exactGC| and |nextTest, after exactGC|, we find out exactGC takes more and more time as tests go on changing from 3~4s initially to 10s each run steadily.
Fabrice: who could look into this?

I never noticed this as I just got cc'd, and I have cc messages off (zillions of bugmails a day as it is).
Flags: needinfo?(fabrice)
This GC is there to primarily for the benefit of helping keep desktop Firefox green, as this forces decoders not already explicitly shutdown to shutdown.

Fixing bug 1050031 and/or bug 1038527 would reduce the need for the exactGC on desktop.

B2G already disposes of its hardware decoders more aggressively than desktop, so we could try only doing the exactGC on desktop and not B2G, and see if that helps B2G here.
cpearce's suggestion sounds reasonable and simple to implement. Jesup, do you need help or can you write the patch?
Flags: needinfo?(fabrice)
(In reply to [PTO until 15 Sep] Chris Pearce (:cpearce) from comment #2)
> B2G already disposes of its hardware decoders more aggressively than
> desktop

Can you point the code of hardware decoder disposal for me?
MediaDecoderReader::ReleaseMediaResources() and IsDormantNeeded(). The MediaOMXReader, MP4Reader (on B2G) and MediaCodecReader implement these. Other backends do not.
Dormancy will not kick in until the test is finished. However, there are cases like test_bug495145.html where we need to release decoders right away in the middle of test.

test_bug495145.html runs 2 media elements at the same time. Since there is only one H264 decoder on B2G, the 2nd media element won't be able to start playing until the decoder of the first element is released.

For now, I am trying to release decoders manually (which is tedious :<) after finishing each token and remove exactGC-per-token from manifest.js. It so far works fine for me and also helps reduce test time.

Will an media element enter dormant state when removed from the document? If so, we just need to do that and dormancy will kick in for the rest of clean-up. Then we can have MediaTestManager to do that after finishing token so the test case writer will have an easier life.
Component: Audio/Video → Audio/Video: Playback
Mass closing do to inactivity.
Feel free to re-open if still needed.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.