Skip to content
Snippets Groups Projects
Commit ed269500 authored by Chris Pearce's avatar Chris Pearce
Browse files

Bug 1315850 - Add more logging to Chromium CDM actors. r=gerald

MozReview-Commit-ID: 2DcprLAE1bg

--HG--
extra : rebase_source : b7de793c7676ace43d34a9556ef803e1bd3df239
parent a8a6db3d
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@
#include "GMPLog.h"
#include "GMPPlatform.h"
#include "mozilla/Unused.h"
#include "nsPrintfCString.h"
#include "base/time.h"
namespace mozilla {
......@@ -29,6 +30,7 @@ ChromiumCDMChild::Init(cdm::ContentDecryptionModule_8* aCDM)
void
ChromiumCDMChild::TimerExpired(void* aContext)
{
GMP_LOG("ChromiumCDMChild::TimerExpired(context=0x%p)", aContext);
if (mCDM) {
mCDM->TimerExpired(aContext);
}
......@@ -37,12 +39,16 @@ ChromiumCDMChild::TimerExpired(void* aContext)
cdm::Buffer*
ChromiumCDMChild::Allocate(uint32_t aCapacity)
{
GMP_LOG("ChromiumCDMChild::Allocate(capacity=%" PRIu32 ")", aCapacity);
return new WidevineBuffer(aCapacity);
}
void
ChromiumCDMChild::SetTimer(int64_t aDelayMs, void* aContext)
{
GMP_LOG("ChromiumCDMChild::SetTimer(delay=%" PRId64 ", context=0x%p)",
aDelayMs,
aContext);
RefPtr<ChromiumCDMChild> self(this);
SetTimerOnMainThread(NewGMPTask([self, aContext]() {
self->TimerExpired(aContext);
......@@ -60,12 +66,17 @@ ChromiumCDMChild::OnResolveNewSessionPromise(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdSize)
{
GMP_LOG("ChromiumCDMChild::OnResolveNewSessionPromise(pid=%" PRIu32
", sid=%s)",
aPromiseId,
aSessionId);
Unused << SendOnResolveNewSessionPromise(aPromiseId,
nsCString(aSessionId, aSessionIdSize));
}
void ChromiumCDMChild::OnResolvePromise(uint32_t aPromiseId)
{
GMP_LOG("ChromiumCDMChild::OnResolvePromise(pid=%" PRIu32 ")", aPromiseId);
Unused << SendOnResolvePromise(aPromiseId);
}
......@@ -76,8 +87,14 @@ ChromiumCDMChild::OnRejectPromise(uint32_t aPromiseId,
const char* aErrorMessage,
uint32_t aErrorMessageSize)
{
GMP_LOG("ChromiumCDMChild::OnRejectPromise(pid=%" PRIu32 ", err=%" PRIu32
" code=%" PRIu32 ", msg='%s')",
aPromiseId,
aError,
aSystemCode,
aErrorMessage);
Unused << SendOnRejectPromise(aPromiseId,
aError,
static_cast<uint32_t>(aError),
aSystemCode,
nsCString(aErrorMessage, aErrorMessageSize));
}
......@@ -91,13 +108,38 @@ ChromiumCDMChild::OnSessionMessage(const char* aSessionId,
const char* aLegacyDestinationUrl,
uint32_t aLegacyDestinationUrlLength)
{
GMP_LOG("ChromiumCDMChild::OnSessionMessage(sid=%s, type=%" PRIu32
" size=%" PRIu32 ")",
aSessionId,
aMessageType,
aMessageSize);
nsTArray<uint8_t> message;
message.AppendElements(aMessage, aMessageSize);
Unused << SendOnSessionMessage(nsCString(aSessionId, aSessionIdSize),
aMessageType,
static_cast<uint32_t>(aMessageType),
message);
}
static nsCString
ToString(const cdm::KeyInformation* aKeysInfo, uint32_t aKeysInfoCount)
{
nsCString str;
for (uint32_t i = 0; i < aKeysInfoCount; i++) {
nsCString keyId;
const cdm::KeyInformation& key = aKeysInfo[i];
for (size_t k = 0; k < key.key_id_size; k++) {
keyId.Append(nsPrintfCString("%hhX", key.key_id[k]));
}
if (!str.IsEmpty()) {
str.AppendLiteral(",");
}
str.Append(keyId);
str.AppendLiteral("=");
str.AppendInt(key.status);
}
return str;
}
void
ChromiumCDMChild::OnSessionKeysChange(const char *aSessionId,
uint32_t aSessionIdSize,
......@@ -105,6 +147,10 @@ ChromiumCDMChild::OnSessionKeysChange(const char *aSessionId,
const cdm::KeyInformation* aKeysInfo,
uint32_t aKeysInfoCount)
{
GMP_LOG("ChromiumCDMChild::OnSessionKeysChange(sid=%s) keys={%s}",
aSessionId,
ToString(aKeysInfo, aKeysInfoCount).get());
nsTArray<CDMKeyInformation> keys;
keys.SetCapacity(aKeysInfoCount);
for (uint32_t i = 0; i < aKeysInfoCount; i++) {
......@@ -122,6 +168,9 @@ ChromiumCDMChild::OnExpirationChange(const char* aSessionId,
uint32_t aSessionIdSize,
cdm::Time aNewExpiryTime)
{
GMP_LOG("ChromiumCDMChild::OnExpirationChange(sid=%s, time=%lf)",
aSessionId,
aNewExpiryTime);
Unused << SendOnExpirationChange(nsCString(aSessionId, aSessionIdSize),
aNewExpiryTime);
}
......@@ -130,6 +179,7 @@ void
ChromiumCDMChild::OnSessionClosed(const char* aSessionId,
uint32_t aSessionIdSize)
{
GMP_LOG("ChromiumCDMChild::OnSessionClosed(sid=%s)", aSessionId);
Unused << SendOnSessionClosed(nsCString(aSessionId, aSessionIdSize));
}
......@@ -141,15 +191,22 @@ ChromiumCDMChild::OnLegacySessionError(const char* aSessionId,
const char* aErrorMessage,
uint32_t aErrorMessageLength)
{
Unused << SendOnLegacySessionError(nsCString(aSessionId, aSessionIdLength),
aError,
aSystemCode,
nsCString(aErrorMessage, aErrorMessageLength));
GMP_LOG("ChromiumCDMChild::OnLegacySessionError(sid=%s, error=%" PRIu32
" msg='%s')",
aSessionId,
aError,
aErrorMessage);
Unused << SendOnLegacySessionError(
nsCString(aSessionId, aSessionIdLength),
static_cast<uint32_t>(aError),
aSystemCode,
nsCString(aErrorMessage, aErrorMessageLength));
}
cdm::FileIO*
ChromiumCDMChild::CreateFileIO(cdm::FileIOClient * aClient)
{
GMP_LOG("ChromiumCDMChild::CreateFileIO()");
return nullptr;
}
......@@ -157,6 +214,9 @@ mozilla::ipc::IPCResult
ChromiumCDMChild::RecvInit(const bool& aAllowDistinctiveIdentifier,
const bool& aAllowPersistentState)
{
GMP_LOG("ChromiumCDMChild::RecvInit(distinctiveId=%d, persistentState=%d)",
aAllowDistinctiveIdentifier,
aAllowPersistentState);
if (mCDM) {
mCDM->Initialize(aAllowDistinctiveIdentifier, aAllowPersistentState);
}
......@@ -168,6 +228,8 @@ ChromiumCDMChild::RecvSetServerCertificate(const uint32_t& aPromiseId,
nsTArray<uint8_t>&& aServerCert)
{
GMP_LOG("ChromiumCDMChild::RecvSetServerCertificate() certlen=%zu",
aServerCert.Length());
if (mCDM) {
mCDM->SetServerCertificate(aPromiseId,
aServerCert.Elements(),
......@@ -183,6 +245,13 @@ ChromiumCDMChild::RecvCreateSessionAndGenerateRequest(
const uint32_t& aInitDataType,
nsTArray<uint8_t>&& aInitData)
{
GMP_LOG("ChromiumCDMChild::RecvCreateSessionAndGenerateRequest("
"pid=%" PRIu32 ", sessionType=%" PRIu32 ", initDataType=%" PRIu32
") initDataLen=%zu",
aPromiseId,
aSessionType,
aInitDataType,
aInitData.Length());
MOZ_ASSERT(aSessionType <= cdm::SessionType::kPersistentKeyRelease);
MOZ_ASSERT(aInitDataType <= cdm::InitDataType::kWebM);
if (mCDM) {
......@@ -200,6 +269,11 @@ ChromiumCDMChild::RecvUpdateSession(const uint32_t& aPromiseId,
const nsCString& aSessionId,
nsTArray<uint8_t>&& aResponse)
{
GMP_LOG("ChromiumCDMChild::RecvUpdateSession(pid=%" PRIu32
", sid=%s) responseLen=%zu",
aPromiseId,
aSessionId.get(),
aResponse.Length());
if (mCDM) {
mCDM->UpdateSession(aPromiseId,
aSessionId.get(),
......@@ -214,6 +288,9 @@ mozilla::ipc::IPCResult
ChromiumCDMChild::RecvCloseSession(const uint32_t& aPromiseId,
const nsCString& aSessionId)
{
GMP_LOG("ChromiumCDMChild::RecvCloseSession(pid=%" PRIu32 ", sid=%s)",
aPromiseId,
aSessionId.get());
if (mCDM) {
mCDM->CloseSession(aPromiseId, aSessionId.get(), aSessionId.Length());
}
......@@ -224,6 +301,9 @@ mozilla::ipc::IPCResult
ChromiumCDMChild::RecvRemoveSession(const uint32_t& aPromiseId,
const nsCString& aSessionId)
{
GMP_LOG("ChromiumCDMChild::RecvRemoveSession(pid=%" PRIu32 ", sid=%s)",
aPromiseId,
aSessionId.get());
if (mCDM) {
mCDM->RemoveSession(aPromiseId, aSessionId.get(), aSessionId.Length());
}
......@@ -233,6 +313,7 @@ ChromiumCDMChild::RecvRemoveSession(const uint32_t& aPromiseId,
mozilla::ipc::IPCResult
ChromiumCDMChild::RecvDecrypt(const CDMInputBuffer& aBuffer)
{
GMP_LOG("ChromiumCDMChild::RecvDecrypt()");
return IPC_OK();
}
......@@ -240,30 +321,36 @@ mozilla::ipc::IPCResult
ChromiumCDMChild::RecvInitializeVideoDecoder(
const CDMVideoDecoderConfig& aConfig)
{
GMP_LOG("ChromiumCDMChild::RecvInitializeVideoDecoder()");
return IPC_OK();
}
mozilla::ipc::IPCResult
ChromiumCDMChild::RecvDeinitializeVideoDecoder()
{
GMP_LOG("ChromiumCDMChild::RecvDeinitializeVideoDecoder()");
return IPC_OK();
}
mozilla::ipc::IPCResult
ChromiumCDMChild::RecvResetVideoDecoder()
{
GMP_LOG("ChromiumCDMChild::RecvResetVideoDecoder()");
return IPC_OK();
}
mozilla::ipc::IPCResult
ChromiumCDMChild::RecvDecryptAndDecodeFrame(const CDMInputBuffer& aBuffer)
{
GMP_LOG("ChromiumCDMChild::RecvDecryptAndDecodeFrame()");
return IPC_OK();
}
mozilla::ipc::IPCResult
ChromiumCDMChild::RecvDestroy()
{
GMP_LOG("ChromiumCDMChild::RecvDestroy()");
if (mCDM) {
mCDM->Destroy();
mCDM = nullptr;
......
......@@ -10,6 +10,7 @@
#include "ChromiumCDMProxy.h"
#include "mozilla/dom/MediaKeyMessageEventBinding.h"
#include "content_decryption_module.h"
#include "GMPLog.h"
namespace mozilla {
namespace gmp {
......@@ -19,6 +20,11 @@ ChromiumCDMParent::ChromiumCDMParent(GMPContentParent* aContentParent,
: mPluginId(aPluginId)
, mContentParent(aContentParent)
{
GMP_LOG(
"ChromiumCDMParent::ChromiumCDMParent(this=%p, contentParent=%p, id=%u)",
this,
aContentParent,
aPluginId);
}
bool
......@@ -26,6 +32,7 @@ ChromiumCDMParent::Init(ChromiumCDMProxy* aProxy,
bool aAllowDistinctiveIdentifier,
bool aAllowPersistentState)
{
GMP_LOG("ChromiumCDMParent::Init(this=%p)", this);
mProxy = aProxy;
return SendInit(aAllowDistinctiveIdentifier, aAllowPersistentState);
}
......@@ -37,6 +44,7 @@ ChromiumCDMParent::CreateSession(uint32_t aCreateSessionToken,
uint32_t aPromiseId,
const nsTArray<uint8_t>& aInitData)
{
GMP_LOG("ChromiumCDMParent::CreateSession(this=%p)", this);
if (!SendCreateSessionAndGenerateRequest(
aPromiseId, aSessionType, aInitDataType, aInitData)) {
RejectPromise(
......@@ -52,6 +60,7 @@ void
ChromiumCDMParent::SetServerCertificate(uint32_t aPromiseId,
const nsTArray<uint8_t>& aCert)
{
GMP_LOG("ChromiumCDMParent::SetServerCertificate(this=%p)", this);
if (!SendSetServerCertificate(aPromiseId, aCert)) {
RejectPromise(
aPromiseId,
......@@ -65,6 +74,7 @@ ChromiumCDMParent::UpdateSession(const nsCString& aSessionId,
uint32_t aPromiseId,
const nsTArray<uint8_t>& aResponse)
{
GMP_LOG("ChromiumCDMParent::UpdateSession(this=%p)", this);
if (!SendUpdateSession(aPromiseId, aSessionId, aResponse)) {
RejectPromise(
aPromiseId,
......@@ -77,6 +87,7 @@ void
ChromiumCDMParent::CloseSession(const nsCString& aSessionId,
uint32_t aPromiseId)
{
GMP_LOG("ChromiumCDMParent::CloseSession(this=%p)", this);
if (!SendCloseSession(aPromiseId, aSessionId)) {
RejectPromise(
aPromiseId,
......@@ -89,6 +100,7 @@ void
ChromiumCDMParent::RemoveSession(const nsCString& aSessionId,
uint32_t aPromiseId)
{
GMP_LOG("ChromiumCDMParent::RemoveSession(this=%p)", this);
if (!SendRemoveSession(aPromiseId, aSessionId)) {
RejectPromise(
aPromiseId,
......@@ -100,6 +112,7 @@ ChromiumCDMParent::RemoveSession(const nsCString& aSessionId,
ipc::IPCResult
ChromiumCDMParent::Recv__delete__()
{
GMP_LOG("ChromiumCDMParent::Recv__delete__(this=%p)", this);
return IPC_OK();
}
......@@ -107,6 +120,11 @@ ipc::IPCResult
ChromiumCDMParent::RecvOnResolveNewSessionPromise(const uint32_t& aPromiseId,
const nsCString& aSessionId)
{
GMP_LOG("ChromiumCDMParent::RecvOnResolveNewSessionPromise(this=%p, pid=%u, "
"sid=%s)",
this,
aPromiseId,
aSessionId.get());
if (!mProxy) {
return IPC_OK();
}
......@@ -134,6 +152,9 @@ ChromiumCDMParent::RecvOnResolveNewSessionPromise(const uint32_t& aPromiseId,
void
ChromiumCDMParent::ResolvePromise(uint32_t aPromiseId)
{
GMP_LOG(
"ChromiumCDMParent::ResolvePromise(this=%p, pid=%u)", this, aPromiseId);
if (!mProxy) {
return;
}
......@@ -180,6 +201,8 @@ ChromiumCDMParent::RejectPromise(uint32_t aPromiseId,
nsresult aError,
const nsCString& aErrorMessage)
{
GMP_LOG(
"ChromiumCDMParent::RejectPromise(this=%p, pid=%u)", this, aPromiseId);
if (!mProxy) {
return;
}
......@@ -221,6 +244,9 @@ ChromiumCDMParent::RecvOnSessionMessage(const nsCString& aSessionId,
const uint32_t& aMessageType,
nsTArray<uint8_t>&& aMessage)
{
GMP_LOG("ChromiumCDMParent::RecvOnSessionMessage(this=%p, sid=%s)",
this,
aSessionId.get());
if (!mProxy) {
return IPC_OK();
}
......@@ -263,6 +289,7 @@ ChromiumCDMParent::RecvOnSessionKeysChange(
const nsCString& aSessionId,
nsTArray<CDMKeyInformation>&& aKeysInfo)
{
GMP_LOG("ChromiumCDMParent::RecvOnSessionKeysChange(this=%p)", this);
if (!mProxy) {
return IPC_OK();
}
......@@ -290,6 +317,9 @@ ipc::IPCResult
ChromiumCDMParent::RecvOnExpirationChange(const nsCString& aSessionId,
const double& aSecondsSinceEpoch)
{
GMP_LOG("ChromiumCDMParent::RecvOnExpirationChange(this=%p) time=%lf",
this,
aSecondsSinceEpoch);
if (!mProxy) {
return IPC_OK();
}
......@@ -304,6 +334,7 @@ ChromiumCDMParent::RecvOnExpirationChange(const nsCString& aSessionId,
ipc::IPCResult
ChromiumCDMParent::RecvOnSessionClosed(const nsCString& aSessionId)
{
GMP_LOG("ChromiumCDMParent::RecvOnSessionClosed(this=%p)", this);
if (!mProxy) {
return IPC_OK();
}
......@@ -320,6 +351,7 @@ ChromiumCDMParent::RecvOnLegacySessionError(const nsCString& aSessionId,
const uint32_t& aSystemCode,
const nsCString& aMessage)
{
GMP_LOG("ChromiumCDMParent::RecvOnLegacySessionError(this=%p)", this);
if (!mProxy) {
return IPC_OK();
}
......@@ -356,6 +388,7 @@ ChromiumCDMParent::RecvDecodeFailed(const uint32_t& aStatus)
ipc::IPCResult
ChromiumCDMParent::RecvShutdown()
{
GMP_LOG("ChromiumCDMParent::RecvShutdown(this=%p)", this);
// TODO: SendDestroy(), call Terminated.
return IPC_OK();
}
......@@ -363,6 +396,7 @@ ChromiumCDMParent::RecvShutdown()
void
ChromiumCDMParent::ActorDestroy(ActorDestroyReason aWhy)
{
GMP_LOG("ChromiumCDMParent::ActorDestroy(this=%p, reason=%d)", this, aWhy);
}
} // namespace gmp
......
......@@ -46,9 +46,12 @@ ChromiumCDMProxy::Init(PromiseId aPromiseId,
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_TRUE_VOID(!mKeys.IsNull());
EME_LOG("ChromiumCDMProxy::Init(%s, %s)",
NS_ConvertUTF16toUTF8(aOrigin).get(),
NS_ConvertUTF16toUTF8(aTopLevelOrigin).get());
EME_LOG(
"ChromiumCDMProxy::Init (pid=%u, origin=%s, topLevelOrigin=%s, gmp=%s)",
aPromiseId,
NS_ConvertUTF16toUTF8(aOrigin).get(),
NS_ConvertUTF16toUTF8(aTopLevelOrigin).get(),
NS_ConvertUTF16toUTF8(aGMPName).get());
if (!mGMPThread) {
RejectPromise(
......@@ -178,6 +181,12 @@ ChromiumCDMProxy::CreateSession(uint32_t aCreateSessionToken,
nsTArray<uint8_t>& aInitData)
{
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::CreateSession(token=%u, type=%d, pid=%u) "
"initDataLen=%zu",
aCreateSessionToken,
(int)aSessionType,
aPromiseId,
aInitData.Length());
uint32_t sessionType = ToCDMSessionType(aSessionType);
uint32_t initDataType = ToCDMInitDataType(aInitDataType);
......@@ -211,6 +220,9 @@ ChromiumCDMProxy::SetServerCertificate(PromiseId aPromiseId,
nsTArray<uint8_t>& aCert)
{
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::SetServerCertificate(pid=%u) certLen=%zu",
aPromiseId,
aCert.Length());
mGMPThread->Dispatch(NewRunnableMethod<uint32_t, nsTArray<uint8_t>>(
mCDM,
......@@ -225,6 +237,10 @@ ChromiumCDMProxy::UpdateSession(const nsAString& aSessionId,
nsTArray<uint8_t>& aResponse)
{
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::UpdateSession(sid='%s', pid=%u) responseLen=%zu",
NS_ConvertUTF16toUTF8(aSessionId).get(),
aPromiseId,
aResponse.Length());
mGMPThread->Dispatch(NewRunnableMethod<nsCString, uint32_t, nsTArray<uint8_t>>(
mCDM,
......@@ -238,6 +254,11 @@ void
ChromiumCDMProxy::CloseSession(const nsAString& aSessionId,
PromiseId aPromiseId)
{
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::CloseSession(sid='%s', pid=%u)",
NS_ConvertUTF16toUTF8(aSessionId).get(),
aPromiseId);
mGMPThread->Dispatch(NewRunnableMethod<nsCString, uint32_t>(
mCDM,
&gmp::ChromiumCDMParent::CloseSession,
......@@ -249,6 +270,11 @@ void
ChromiumCDMProxy::RemoveSession(const nsAString& aSessionId,
PromiseId aPromiseId)
{
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::RemoveSession(sid='%s', pid=%u)",
NS_ConvertUTF16toUTF8(aSessionId).get(),
aPromiseId);
mGMPThread->Dispatch(NewRunnableMethod<nsCString, uint32_t>(
mCDM,
&gmp::ChromiumCDMParent::RemoveSession,
......@@ -259,6 +285,7 @@ ChromiumCDMProxy::RemoveSession(const nsAString& aSessionId,
void
ChromiumCDMProxy::Shutdown()
{
EME_LOG("ChromiumCDMProxy::Shutdown()");
}
void
......@@ -273,6 +300,10 @@ ChromiumCDMProxy::RejectPromise(PromiseId aId,
NS_DispatchToMainThread(task);
return;
}
EME_LOG("ChromiumCDMProxy::RejectPromise(pid=%u, code=0x%x, reason='%s')",
aId,
static_cast<uint32_t>(aCode),
aReason.get());
if (!mKeys.IsNull()) {
mKeys->RejectPromise(aId, aCode, aReason);
}
......@@ -289,6 +320,7 @@ ChromiumCDMProxy::ResolvePromise(PromiseId aId)
return;
}
EME_LOG("ChromiumCDMProxy::ResolvePromise(pid=%u)", aId);
if (!mKeys.IsNull()) {
mKeys->ResolvePromise(aId);
} else {
......@@ -307,6 +339,10 @@ ChromiumCDMProxy::OnSetSessionId(uint32_t aCreateSessionToken,
const nsAString& aSessionId)
{
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::OnSetSessionId(token=%u, sid='%s')",
aCreateSessionToken,
NS_ConvertUTF16toUTF8(aSessionId).get());
if (mKeys.IsNull()) {
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment