Closed Bug 1885350 Opened 8 months ago Closed 8 months ago

navigator.requestMediaKeySystemAccess > 1000x slowdown

Categories

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

defect

Tracking

()

RESOLVED FIXED
125 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox123 --- unaffected
firefox124 --- unaffected
firefox125 + fixed

People

(Reporter: thorin, Assigned: alwu)

References

(Regression)

Details

(Keywords: regression)

Attachments

(5 files)

moz-regression: Bug 1881620

STR:

  • load about:blank
  • paste js below into console and hit enter
  • expected: e.g. 4ms
  • got: 5000+ms
function test() {
	let t0 = performance.now()
	function exit(value) {
		let t1 = performance.now()
		console.log(t1 - t0, "ms", value)
	}
	const config = {
		initDataTypes: ['cenc'],
		videoCapabilities: [{
			contentType: 'video/mp4;codecs="avc1.4D401E"'
		}],
		persistentState: "required"
	}
	navigator.requestMediaKeySystemAccess("org.w3.clearkey", [config]).then((key) => {
		exit(true)
	})
	.catch(function(e){
		exit("error")
	})
}
test()
Keywords: regression
Regressed by: 1881620

[Tracking Requested - why for this release]: A large noticeable performance regression.

Set release status flags based on info from the regressing bug 1881620

:alwu, since you are the author of the regressor, bug 1881620, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Assignee: nobody → alwu
Severity: -- → S3
Flags: needinfo?(alwu)
Priority: -- → P1

There are some key system names are designed for hardware decryption
only in our implementation. When a website requests for a EME playback,
they could use those key systems but don't specifiy the robustness in
their config.

Therefore, for getting a precise result, we need to consider the key
system name together as well.

The primary reason of causing the performance bad is that we always
look up ALL key system configs even if some configs are apparently not
related with the request's key system. Especially it takes longer time
to request configs from MFCDM.

This patch allows us only check those configs related with the request's
key system name so that we won't need to spend time on unnecessary
configs.

Depends on D204682

Before we always query the capabilities from both software and hardware
decryption for every key system which WMFCDMImpl supports, now it should
only query the exact decryption state that we need.

Depends on D204712

The bug is marked as tracked for firefox125 (nightly). However, the bug still has low severity.

:jimm, could you please increase the severity for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

Flags: needinfo?(jmathies)

Will this still be slow if the site is asking for playready?

Flags: needinfo?(alwu)

Yes, but only for the first time, we will cache the result to avoid asking from CDM again.

Flags: needinfo?(alwu)

(In reply to Alastor Wu [:alwu] from comment #9)

Yes, but only for the first time, we will cache the result to avoid asking from CDM again.

Does Edge have the same note?

Flags: needinfo?(alwu)

What do you mean for the same note? do you mean if they cache the result as well, or do that spend similar time on asking CDM? It you test those JS code on Edge, the result will be quick. It will also take similar time for us after we cache the result from CDM, I am not sure if they already ask the result first before we calling the API.

--

Severity should still be S3, this can be fixed by turning off the pref media.wmf.media-engine.enabled, and this is the Nightly only pref.

Flags: needinfo?(alwu)

(In reply to Alastor Wu [:alwu] from comment #11)

What do you mean for the same note? do you mean if they cache the result as well, or do that spend similar time on asking CDM? It you test those JS code on Edge, the result will be quick. It will also take similar time for us after we cache the result from CDM, I am not sure if they already ask the result first before we calling the API.

--
Severity should still be S3, this can be fixed by turning off the pref media.wmf.media-engine.enabled, and this is the Nightly only pref.

I don't know why I wrote "note". I meant to write "Does Edge have the same problem?" It sounds like they don't. I feel like a first run time of 5s is still too slow. I'll try to take a look at what Edge is doing today.

(In reply to Jeff Muizelaar [:jrmuizel] from comment #12)

I don't know why I wrote "note". I meant to write "Does Edge have the same problem?" It sounds like they don't. I feel like a first run time of 5s is still too slow. I'll try to take a look at what Edge is doing today.

Oh for sure, it won't need to take 5s after landing the fix. For a query to PlayReady, it would be less than 1s on my debug build for the first run, and it can definitely be improved more.

I'm currently working on a further improvement, and only do the minimum version of improvement on this bug in order to solve the problem because the full improvement takes more time.

Pushed by alwu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1fc2b6e3f660 part1 : check the key system name to know whether the hardware decryption is in use. r=jolin https://hg.mozilla.org/integration/autoland/rev/bee288a5eec0 part2 : only request related configs based on request's key system name. r=jolin https://hg.mozilla.org/integration/autoland/rev/c963a060362f part3 : remove 'WMFCDMImpl::Supports' because we don't need to explicitly download PlayReady and WMF-based ClearKey. r=jolin https://hg.mozilla.org/integration/autoland/rev/64afd4092c58 part4 : let WMFCDMImpl only query the specific decryption status. r=jolin

verified fixed for clearkey - back to 5ms

Blocks: 1885739
Flags: needinfo?(jmathies)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: