Skip to content

Commit

Permalink
Bug 1837061 - part7 : always set persistentState and distinctiveID on…
Browse files Browse the repository at this point in the history
… MFCDMCapabilitiesIPDL to avoid assertion caused by unintialized value during serialization. r=jolin

For KeySystemConfig::Requirement, we don't serialize 0, which is not in
the range. [1]

Also set the key system name in the beginning in order to help
debugging.

[1]
https://searchfox.org/mozilla-central/rev/b91e9bef5a6d6f7b549fbc9cba70cb4665ed3866/dom/media/ipc/MFCDMSerializers.h#17-21

Depends on D180273

Differential Revision: https://phabricator.services.mozilla.com/D180275
  • Loading branch information
alastor0325 committed Jun 14, 2023
1 parent ecd1b20 commit 4e1c202
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions dom/media/ipc/MFCDMParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ mozilla::ipc::IPCResult MFCDMParent::RecvGetCapabilities(
MFCDM_REJECT_IF(!mFactory, NS_ERROR_DOM_NOT_SUPPORTED_ERR);

MFCDMCapabilitiesIPDL capabilities;
capabilities.keySystem() = mKeySystem;
// WMF CDMs usually require these. See
// https://source.chromium.org/chromium/chromium/src/+/main:media/cdm/win/media_foundation_cdm_factory.cc;l=69-73;drc=b3ca5c09fa0aa07b7f9921501f75e43d80f3ba48
capabilities.persistentState() = KeySystemConfig::Requirement::Required;
capabilities.distinctiveID() = KeySystemConfig::Requirement::Required;

// TODO : check HW CDM creation
// TODO : add HEVC support?
Expand All @@ -214,7 +219,7 @@ mozilla::ipc::IPCResult MFCDMParent::RecvGetCapabilities(
}
}
if (supportedVideoCodecs.IsEmpty()) {
// Return empty capabilities when no video codec is supported.
// Return a capabilities with no codec supported.
aResolver(std::move(capabilities));
return IPC_OK();
}
Expand Down Expand Up @@ -264,12 +269,6 @@ mozilla::ipc::IPCResult MFCDMParent::RecvGetCapabilities(
KeySystemConfig::SessionType::Temporary);
capabilities.sessionTypes().AppendElement(
KeySystemConfig::SessionType::PersistentLicense);
// WMF CDMs usually require these. See
// https://source.chromium.org/chromium/chromium/src/+/main:media/cdm/win/media_foundation_cdm_factory.cc;l=69-73;drc=b3ca5c09fa0aa07b7f9921501f75e43d80f3ba48
capabilities.persistentState() = KeySystemConfig::Requirement::Required;
capabilities.distinctiveID() = KeySystemConfig::Requirement::Required;

capabilities.keySystem() = mKeySystem;

aResolver(std::move(capabilities));
return IPC_OK();
Expand Down

0 comments on commit 4e1c202

Please sign in to comment.