Bug 1846848 - part3 : add a way to get CDM capabilities from the chrome process. r=gerard-majax,jolin
Differential Revision: https://phabricator.services.mozilla.com/D194452
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "mozilla/EMEUtils.h"
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "MediaData.h"
|
||||
#include "mozilla/StaticPrefs_media.h"
|
||||
#include "mozilla/dom/KeySystemNames.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
@@ -128,4 +129,17 @@ bool IsHardwareDecryptionSupported(
|
||||
return supportHardwareDecryption;
|
||||
}
|
||||
|
||||
const char* EncryptionSchemeStr(const CryptoScheme& aScheme) {
|
||||
switch (aScheme) {
|
||||
case CryptoScheme::None:
|
||||
return "none";
|
||||
case CryptoScheme::Cenc:
|
||||
return "cenc";
|
||||
case CryptoScheme::Cbcs:
|
||||
return "cbcs";
|
||||
default:
|
||||
return "not-defined!";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum class CryptoScheme : uint8_t;
|
||||
|
||||
namespace dom {
|
||||
class ArrayBufferViewOrArrayBuffer;
|
||||
}
|
||||
@@ -78,6 +80,8 @@ const char* ToMediaKeyStatusStr(dom::MediaKeyStatus aStatus);
|
||||
bool IsHardwareDecryptionSupported(
|
||||
const dom::MediaKeySystemConfiguration& aConfig);
|
||||
|
||||
const char* EncryptionSchemeStr(const CryptoScheme& aScheme);
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // EME_LOG_H_
|
||||
|
||||
@@ -64,17 +64,6 @@ static void MFCDMCapabilitiesIPDLToKeySystemConfig(
|
||||
NS_ConvertUTF16toUTF8(aKeySystemConfig.GetDebugInfo()).get());
|
||||
}
|
||||
|
||||
static const char* EncryptionSchemeStr(const CryptoScheme aScheme) {
|
||||
switch (aScheme) {
|
||||
case CryptoScheme::None:
|
||||
return "none";
|
||||
case CryptoScheme::Cenc:
|
||||
return "cenc";
|
||||
case CryptoScheme::Cbcs:
|
||||
return "cbcs";
|
||||
}
|
||||
}
|
||||
|
||||
bool WMFCDMImpl::GetCapabilities(nsTArray<KeySystemConfig>& aOutConfigs) {
|
||||
nsCOMPtr<nsISerialEventTarget> backgroundTaskQueue;
|
||||
NS_CreateBackgroundTaskQueue(__func__, getter_AddRefs(backgroundTaskQueue));
|
||||
|
||||
@@ -11,6 +11,10 @@ using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
||||
using mozilla::media::MediaCodecsSupported from "MediaCodecsSupport.h";
|
||||
using mozilla::RemoteDecodeIn from "mozilla/RemoteDecoderManagerChild.h";
|
||||
|
||||
#ifdef MOZ_WMF_CDM
|
||||
using mozilla::MFCDMCapabilitiesIPDL from "mozilla/PMFCDM.h";
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace ipc {
|
||||
@@ -31,6 +35,10 @@ parent:
|
||||
async UpdateVar(GfxVarUpdate var);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WMF_CDM
|
||||
async GetKeySystemCapabilities() returns (MFCDMCapabilitiesIPDL[] result);
|
||||
#endif
|
||||
|
||||
child:
|
||||
async UpdateMediaCodecsSupported(RemoteDecodeIn aLocation,
|
||||
MediaCodecsSupported aSupported);
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
# include "mozilla/layers/VideoBridgeUtils.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WMF_CDM
|
||||
# include "mozilla/EMEUtils.h"
|
||||
# include "mozilla/PMFCDM.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla::ipc {
|
||||
|
||||
NS_IMETHODIMP UtilityAudioDecoderChildShutdownObserver::Observe(
|
||||
@@ -173,4 +178,33 @@ bool UtilityAudioDecoderChild::CreateVideoBridge() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WMF_CDM
|
||||
void UtilityAudioDecoderChild::GetKeySystemCapabilities() {
|
||||
EME_LOG("Ask capabilities for all supported CDMs");
|
||||
SendGetKeySystemCapabilities()->Then(
|
||||
NS_GetCurrentThread(), __func__,
|
||||
[](CopyableTArray<MFCDMCapabilitiesIPDL>&& result) {
|
||||
for (const auto& capabilities : result) {
|
||||
EME_LOG("Received capabilities for %s",
|
||||
NS_ConvertUTF16toUTF8(capabilities.keySystem()).get());
|
||||
for (const auto& v : capabilities.videoCapabilities()) {
|
||||
EME_LOG(" capabilities: video=%s",
|
||||
NS_ConvertUTF16toUTF8(v.contentType()).get());
|
||||
}
|
||||
for (const auto& a : capabilities.audioCapabilities()) {
|
||||
EME_LOG(" capabilities: audio=%s",
|
||||
NS_ConvertUTF16toUTF8(a.contentType()).get());
|
||||
}
|
||||
for (const auto& e : capabilities.encryptionSchemes()) {
|
||||
EME_LOG(" capabilities: encryptionScheme=%s",
|
||||
EncryptionSchemeStr(e));
|
||||
}
|
||||
}
|
||||
},
|
||||
[](const mozilla::ipc::ResponseRejectReason& aReason) {
|
||||
EME_LOG("IPC failure for GetKeySystemCapabilities!");
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mozilla::ipc
|
||||
|
||||
@@ -107,6 +107,10 @@ class UtilityAudioDecoderChild final : public PUtilityAudioDecoderChild
|
||||
bool CreateVideoBridge();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WMF_CDM
|
||||
void GetKeySystemCapabilities();
|
||||
#endif
|
||||
|
||||
private:
|
||||
explicit UtilityAudioDecoderChild(SandboxingKind aKind);
|
||||
~UtilityAudioDecoderChild() = default;
|
||||
|
||||
@@ -35,6 +35,11 @@
|
||||
# include "gfxConfig.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WMF_CDM
|
||||
# include "mozilla/MFCDMParent.h"
|
||||
# include "mozilla/PMFCDM.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla::ipc {
|
||||
|
||||
UtilityAudioDecoderParent::UtilityAudioDecoderParent()
|
||||
@@ -170,4 +175,20 @@ IPCResult UtilityAudioDecoderParent::RecvUpdateVar(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WMF_CDM
|
||||
IPCResult UtilityAudioDecoderParent::RecvGetKeySystemCapabilities(
|
||||
GetKeySystemCapabilitiesResolver&& aResolver) {
|
||||
MOZ_ASSERT(mKind == SandboxingKind::MF_MEDIA_ENGINE_CDM);
|
||||
MFCDMParent::GetAllKeySystemsCapabilities()->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[aResolver](CopyableTArray<MFCDMCapabilitiesIPDL>&& aCapabilities) {
|
||||
aResolver(std::move(aCapabilities));
|
||||
},
|
||||
[aResolver](nsresult) {
|
||||
aResolver(CopyableTArray<MFCDMCapabilitiesIPDL>());
|
||||
});
|
||||
return IPC_OK();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mozilla::ipc
|
||||
|
||||
@@ -45,6 +45,11 @@ class UtilityAudioDecoderParent final : public PUtilityAudioDecoderParent {
|
||||
IPCResult RecvUpdateVar(const mozilla::gfx::GfxVarUpdate& aUpdate);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WMF_CDM
|
||||
IPCResult RecvGetKeySystemCapabilities(
|
||||
GetKeySystemCapabilitiesResolver&& aResolver);
|
||||
#endif
|
||||
|
||||
private:
|
||||
~UtilityAudioDecoderParent();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user