mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1194576 - Add more NSPR logging around GMP*Parent actors. r=gerald
This commit is contained in:
parent
a8320dc97c
commit
2ad25b6368
@ -16,7 +16,7 @@
|
|||||||
#include "mozilla/Move.h"
|
#include "mozilla/Move.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "mozilla/EMEUtils.h"
|
#include "mozilla/EMEUtils.h"
|
||||||
#include "mozilla/Base64.h"
|
#include "GMPUtils.h"
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@ -143,14 +143,7 @@ MediaKeySession::UpdateKeyStatusMap()
|
|||||||
nsPrintfCString("MediaKeySession[%p,'%s'] key statuses change {",
|
nsPrintfCString("MediaKeySession[%p,'%s'] key statuses change {",
|
||||||
this, NS_ConvertUTF16toUTF8(mSessionId).get()));
|
this, NS_ConvertUTF16toUTF8(mSessionId).get()));
|
||||||
for (const CDMCaps::KeyStatus& status : keyStatuses) {
|
for (const CDMCaps::KeyStatus& status : keyStatuses) {
|
||||||
nsAutoCString base64KeyId;
|
message.Append(nsPrintfCString(" (%s,%s)", ToBase64(status.mId).get(),
|
||||||
nsDependentCSubstring rawKeyId(reinterpret_cast<const char*>(status.mId.Elements()),
|
|
||||||
status.mId.Length());
|
|
||||||
nsresult rv = Base64Encode(rawKeyId, base64KeyId);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
message.Append(nsPrintfCString(" (%s,%s)", base64KeyId.get(),
|
|
||||||
MediaKeyStatusValues::strings[status.mStatus].value));
|
MediaKeyStatusValues::strings[status.mStatus].value));
|
||||||
}
|
}
|
||||||
message.Append(" }");
|
message.Append(" }");
|
||||||
@ -197,17 +190,9 @@ MediaKeySession::GenerateRequest(const nsAString& aInitDataType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert initData to base64 for easier logging.
|
// Convert initData to base64 for easier logging.
|
||||||
// Note: UpdateSession() Move()s the data out of the array, so we have
|
// Note: CreateSession() Move()s the data out of the array, so we have
|
||||||
// to copy it here.
|
// to copy it here.
|
||||||
nsAutoCString base64InitData;
|
nsAutoCString base64InitData(ToBase64(data));
|
||||||
if (EME_LOG_ENABLED()) {
|
|
||||||
nsDependentCSubstring rawInitData(reinterpret_cast<const char*>(data.Elements()),
|
|
||||||
data.Length());
|
|
||||||
if (NS_FAILED(Base64Encode(rawInitData, base64InitData))) {
|
|
||||||
NS_WARNING("Failed to base64 encode initData for logging");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PromiseId pid = mKeys->StorePromise(promise);
|
PromiseId pid = mKeys->StorePromise(promise);
|
||||||
mKeys->GetCDMProxy()->CreateSession(Token(),
|
mKeys->GetCDMProxy()->CreateSession(Token(),
|
||||||
mSessionType,
|
mSessionType,
|
||||||
@ -296,14 +281,7 @@ MediaKeySession::Update(const ArrayBufferViewOrArrayBuffer& aResponse, ErrorResu
|
|||||||
// Convert response to base64 for easier logging.
|
// Convert response to base64 for easier logging.
|
||||||
// Note: UpdateSession() Move()s the data out of the array, so we have
|
// Note: UpdateSession() Move()s the data out of the array, so we have
|
||||||
// to copy it here.
|
// to copy it here.
|
||||||
nsAutoCString base64Response;
|
nsAutoCString base64Response(ToBase64(data));
|
||||||
if (EME_LOG_ENABLED()) {
|
|
||||||
nsDependentCSubstring rawResponse(reinterpret_cast<const char*>(data.Elements()),
|
|
||||||
data.Length());
|
|
||||||
if (NS_FAILED(Base64Encode(rawResponse, base64Response))) {
|
|
||||||
NS_WARNING("Failed to base64 encode response for logging");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PromiseId pid = mKeys->StorePromise(promise);
|
PromiseId pid = mKeys->StorePromise(promise);
|
||||||
mKeys->GetCDMProxy()->UpdateSession(mSessionId,
|
mKeys->GetCDMProxy()->UpdateSession(mSessionId,
|
||||||
@ -400,16 +378,10 @@ MediaKeySession::DispatchKeyMessage(MediaKeyMessageType aMessageType,
|
|||||||
const nsTArray<uint8_t>& aMessage)
|
const nsTArray<uint8_t>& aMessage)
|
||||||
{
|
{
|
||||||
if (EME_LOG_ENABLED()) {
|
if (EME_LOG_ENABLED()) {
|
||||||
nsAutoCString base64MsgData;
|
|
||||||
nsDependentCSubstring rawMsgData(reinterpret_cast<const char*>(aMessage.Elements()),
|
|
||||||
aMessage.Length());
|
|
||||||
if (NS_FAILED(Base64Encode(rawMsgData, base64MsgData))) {
|
|
||||||
NS_WARNING("Failed to base64 encode message for logging");
|
|
||||||
}
|
|
||||||
EME_LOG("MediaKeySession[%p,'%s'] DispatchKeyMessage() type=%s message(base64)='%s'",
|
EME_LOG("MediaKeySession[%p,'%s'] DispatchKeyMessage() type=%s message(base64)='%s'",
|
||||||
this, NS_ConvertUTF16toUTF8(mSessionId).get(),
|
this, NS_ConvertUTF16toUTF8(mSessionId).get(),
|
||||||
MediaKeyMessageTypeValues::strings[uint32_t(aMessageType)].value,
|
MediaKeyMessageTypeValues::strings[uint32_t(aMessageType)].value,
|
||||||
base64MsgData.get());
|
ToBase64(aMessage).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<MediaKeyMessageEvent> event(
|
nsRefPtr<MediaKeyMessageEvent> event(
|
||||||
|
@ -19,6 +19,7 @@ namespace mozilla {
|
|||||||
|
|
||||||
extern PRLogModuleInfo* GetGMPLog();
|
extern PRLogModuleInfo* GetGMPLog();
|
||||||
|
|
||||||
|
#define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg)
|
||||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
|
#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
|
||||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||||
|
|
||||||
@ -48,6 +49,8 @@ GMPAudioDecoderParent::InitDecode(GMPAudioCodecType aCodecType,
|
|||||||
nsTArray<uint8_t>& aExtraData,
|
nsTArray<uint8_t>& aExtraData,
|
||||||
GMPAudioDecoderCallbackProxy* aCallback)
|
GMPAudioDecoderCallbackProxy* aCallback)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::InitDecode()", this));
|
||||||
|
|
||||||
if (mIsOpen) {
|
if (mIsOpen) {
|
||||||
NS_WARNING("Trying to re-init an in-use GMP audio decoder!");
|
NS_WARNING("Trying to re-init an in-use GMP audio decoder!");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -78,6 +81,8 @@ GMPAudioDecoderParent::InitDecode(GMPAudioCodecType aCodecType,
|
|||||||
nsresult
|
nsresult
|
||||||
GMPAudioDecoderParent::Decode(GMPAudioSamplesImpl& aEncodedSamples)
|
GMPAudioDecoderParent::Decode(GMPAudioSamplesImpl& aEncodedSamples)
|
||||||
{
|
{
|
||||||
|
LOGV(("GMPAudioDecoderParent[%p]::Decode() timestamp=%lld",
|
||||||
|
this, aEncodedSamples.TimeStamp()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP Audio decoder!");
|
NS_WARNING("Trying to use a dead GMP Audio decoder!");
|
||||||
@ -100,6 +105,8 @@ GMPAudioDecoderParent::Decode(GMPAudioSamplesImpl& aEncodedSamples)
|
|||||||
nsresult
|
nsresult
|
||||||
GMPAudioDecoderParent::Reset()
|
GMPAudioDecoderParent::Reset()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::Reset()", this));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP Audio decoder!");
|
NS_WARNING("Trying to use a dead GMP Audio decoder!");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -120,6 +127,8 @@ GMPAudioDecoderParent::Reset()
|
|||||||
nsresult
|
nsresult
|
||||||
GMPAudioDecoderParent::Drain()
|
GMPAudioDecoderParent::Drain()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::Drain()", this));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP Audio decoder!");
|
NS_WARNING("Trying to use a dead GMP Audio decoder!");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -141,7 +150,7 @@ GMPAudioDecoderParent::Drain()
|
|||||||
nsresult
|
nsresult
|
||||||
GMPAudioDecoderParent::Close()
|
GMPAudioDecoderParent::Close()
|
||||||
{
|
{
|
||||||
LOGD(("%s: %p", __FUNCTION__, this));
|
LOGD(("GMPAudioDecoderParent[%p]::Close()", this));
|
||||||
MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread());
|
MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread());
|
||||||
|
|
||||||
// Ensure if we've received a Close while waiting for a ResetComplete
|
// Ensure if we've received a Close while waiting for a ResetComplete
|
||||||
@ -166,7 +175,7 @@ GMPAudioDecoderParent::Close()
|
|||||||
nsresult
|
nsresult
|
||||||
GMPAudioDecoderParent::Shutdown()
|
GMPAudioDecoderParent::Shutdown()
|
||||||
{
|
{
|
||||||
LOGD(("%s: %p", __FUNCTION__, this));
|
LOGD(("GMPAudioDecoderParent[%p]::Shutdown()", this));
|
||||||
MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread());
|
MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread());
|
||||||
|
|
||||||
if (mShuttingDown) {
|
if (mShuttingDown) {
|
||||||
@ -197,6 +206,8 @@ GMPAudioDecoderParent::Shutdown()
|
|||||||
void
|
void
|
||||||
GMPAudioDecoderParent::ActorDestroy(ActorDestroyReason aWhy)
|
GMPAudioDecoderParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::ActorDestroy(reason=%d)", this, aWhy));
|
||||||
|
|
||||||
mIsOpen = false;
|
mIsOpen = false;
|
||||||
mActorDestroyed = true;
|
mActorDestroyed = true;
|
||||||
|
|
||||||
@ -220,6 +231,9 @@ GMPAudioDecoderParent::ActorDestroy(ActorDestroyReason aWhy)
|
|||||||
bool
|
bool
|
||||||
GMPAudioDecoderParent::RecvDecoded(const GMPAudioDecodedSampleData& aDecoded)
|
GMPAudioDecoderParent::RecvDecoded(const GMPAudioDecodedSampleData& aDecoded)
|
||||||
{
|
{
|
||||||
|
LOGV(("GMPAudioDecoderParent[%p]::RecvDecoded() timestamp=%lld",
|
||||||
|
this, aDecoded.mTimeStamp()));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -235,6 +249,8 @@ GMPAudioDecoderParent::RecvDecoded(const GMPAudioDecodedSampleData& aDecoded)
|
|||||||
bool
|
bool
|
||||||
GMPAudioDecoderParent::RecvInputDataExhausted()
|
GMPAudioDecoderParent::RecvInputDataExhausted()
|
||||||
{
|
{
|
||||||
|
LOGV(("GMPAudioDecoderParent[%p]::RecvInputDataExhausted()", this));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -248,6 +264,8 @@ GMPAudioDecoderParent::RecvInputDataExhausted()
|
|||||||
bool
|
bool
|
||||||
GMPAudioDecoderParent::RecvDrainComplete()
|
GMPAudioDecoderParent::RecvDrainComplete()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::RecvDrainComplete()", this));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -266,6 +284,8 @@ GMPAudioDecoderParent::RecvDrainComplete()
|
|||||||
bool
|
bool
|
||||||
GMPAudioDecoderParent::RecvResetComplete()
|
GMPAudioDecoderParent::RecvResetComplete()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::RecvResetComplete()", this));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -284,6 +304,8 @@ GMPAudioDecoderParent::RecvResetComplete()
|
|||||||
bool
|
bool
|
||||||
GMPAudioDecoderParent::RecvError(const GMPErr& aError)
|
GMPAudioDecoderParent::RecvError(const GMPErr& aError)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::RecvError(error=%d)", this, aError));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -302,6 +324,8 @@ GMPAudioDecoderParent::RecvError(const GMPErr& aError)
|
|||||||
bool
|
bool
|
||||||
GMPAudioDecoderParent::RecvShutdown()
|
GMPAudioDecoderParent::RecvShutdown()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::RecvShutdown()", this));
|
||||||
|
|
||||||
Shutdown();
|
Shutdown();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -309,6 +333,8 @@ GMPAudioDecoderParent::RecvShutdown()
|
|||||||
bool
|
bool
|
||||||
GMPAudioDecoderParent::Recv__delete__()
|
GMPAudioDecoderParent::Recv__delete__()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::Recv__delete__()", this));
|
||||||
|
|
||||||
if (mPlugin) {
|
if (mPlugin) {
|
||||||
// Ignore any return code. It is OK for this to fail without killing the process.
|
// Ignore any return code. It is OK for this to fail without killing the process.
|
||||||
mPlugin->AudioDecoderDestroyed(this);
|
mPlugin->AudioDecoderDestroyed(this);
|
||||||
@ -321,6 +347,8 @@ GMPAudioDecoderParent::Recv__delete__()
|
|||||||
void
|
void
|
||||||
GMPAudioDecoderParent::UnblockResetAndDrain()
|
GMPAudioDecoderParent::UnblockResetAndDrain()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPAudioDecoderParent[%p]::UnblockResetAndDrain()", this));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
MOZ_ASSERT(!mIsAwaitingResetComplete);
|
MOZ_ASSERT(!mIsAwaitingResetComplete);
|
||||||
MOZ_ASSERT(!mIsAwaitingDrainComplete);
|
MOZ_ASSERT(!mIsAwaitingDrainComplete);
|
||||||
|
@ -9,6 +9,17 @@
|
|||||||
#include "mozilla/unused.h"
|
#include "mozilla/unused.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
#ifdef LOG
|
||||||
|
#undef LOG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern PRLogModuleInfo* GetGMPLog();
|
||||||
|
|
||||||
|
#define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg)
|
||||||
|
#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
|
||||||
|
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||||
|
|
||||||
namespace gmp {
|
namespace gmp {
|
||||||
|
|
||||||
GMPDecryptorParent::GMPDecryptorParent(GMPContentParent* aPlugin)
|
GMPDecryptorParent::GMPDecryptorParent(GMPContentParent* aPlugin)
|
||||||
@ -32,6 +43,8 @@ GMPDecryptorParent::~GMPDecryptorParent()
|
|||||||
nsresult
|
nsresult
|
||||||
GMPDecryptorParent::Init(GMPDecryptorProxyCallback* aCallback)
|
GMPDecryptorParent::Init(GMPDecryptorProxyCallback* aCallback)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::Init()", this));
|
||||||
|
|
||||||
if (mIsOpen) {
|
if (mIsOpen) {
|
||||||
NS_WARNING("Trying to re-use an in-use GMP decrypter!");
|
NS_WARNING("Trying to re-use an in-use GMP decrypter!");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -51,6 +64,9 @@ GMPDecryptorParent::CreateSession(uint32_t aCreateSessionToken,
|
|||||||
const nsTArray<uint8_t>& aInitData,
|
const nsTArray<uint8_t>& aInitData,
|
||||||
GMPSessionType aSessionType)
|
GMPSessionType aSessionType)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::CreateSession(token=%u, promiseId=%u, aInitData='%s')",
|
||||||
|
this, aCreateSessionToken, aPromiseId, ToBase64(aInitData).get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return;
|
return;
|
||||||
@ -64,6 +80,8 @@ void
|
|||||||
GMPDecryptorParent::LoadSession(uint32_t aPromiseId,
|
GMPDecryptorParent::LoadSession(uint32_t aPromiseId,
|
||||||
const nsCString& aSessionId)
|
const nsCString& aSessionId)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::LoadSession(sessionId='%s', promiseId=%u)",
|
||||||
|
this, aSessionId.get(), aPromiseId));
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return;
|
return;
|
||||||
@ -78,6 +96,9 @@ GMPDecryptorParent::UpdateSession(uint32_t aPromiseId,
|
|||||||
const nsCString& aSessionId,
|
const nsCString& aSessionId,
|
||||||
const nsTArray<uint8_t>& aResponse)
|
const nsTArray<uint8_t>& aResponse)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::UpdateSession(sessionId='%s', promiseId=%u response='%s')",
|
||||||
|
this, aSessionId.get(), aPromiseId, ToBase64(aResponse).get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return;
|
return;
|
||||||
@ -91,6 +112,9 @@ void
|
|||||||
GMPDecryptorParent::CloseSession(uint32_t aPromiseId,
|
GMPDecryptorParent::CloseSession(uint32_t aPromiseId,
|
||||||
const nsCString& aSessionId)
|
const nsCString& aSessionId)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::CloseSession(sessionId='%s', promiseId=%u)",
|
||||||
|
this, aSessionId.get(), aPromiseId));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return;
|
return;
|
||||||
@ -104,6 +128,9 @@ void
|
|||||||
GMPDecryptorParent::RemoveSession(uint32_t aPromiseId,
|
GMPDecryptorParent::RemoveSession(uint32_t aPromiseId,
|
||||||
const nsCString& aSessionId)
|
const nsCString& aSessionId)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RemoveSession(sessionId='%s', promiseId=%u)",
|
||||||
|
this, aSessionId.get(), aPromiseId));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return;
|
return;
|
||||||
@ -117,6 +144,9 @@ void
|
|||||||
GMPDecryptorParent::SetServerCertificate(uint32_t aPromiseId,
|
GMPDecryptorParent::SetServerCertificate(uint32_t aPromiseId,
|
||||||
const nsTArray<uint8_t>& aServerCert)
|
const nsTArray<uint8_t>& aServerCert)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::SetServerCertificate(promiseId=%u)",
|
||||||
|
this, aPromiseId));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return;
|
return;
|
||||||
@ -131,6 +161,8 @@ GMPDecryptorParent::Decrypt(uint32_t aId,
|
|||||||
const CryptoSample& aCrypto,
|
const CryptoSample& aCrypto,
|
||||||
const nsTArray<uint8_t>& aBuffer)
|
const nsTArray<uint8_t>& aBuffer)
|
||||||
{
|
{
|
||||||
|
LOGV(("GMPDecryptorParent[%p]::Decrypt(id=%d)", this, aId));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return;
|
return;
|
||||||
@ -152,6 +184,9 @@ bool
|
|||||||
GMPDecryptorParent::RecvSetSessionId(const uint32_t& aCreateSessionId,
|
GMPDecryptorParent::RecvSetSessionId(const uint32_t& aCreateSessionId,
|
||||||
const nsCString& aSessionId)
|
const nsCString& aSessionId)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvSetSessionId(token=%u, sessionId='%s')",
|
||||||
|
this, aCreateSessionId, aSessionId.get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -164,6 +199,9 @@ bool
|
|||||||
GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
|
GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
|
||||||
const bool& aSuccess)
|
const bool& aSuccess)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvResolveLoadSessionPromise(promiseId=%u)",
|
||||||
|
this, aPromiseId));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -175,6 +213,9 @@ GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
|
|||||||
bool
|
bool
|
||||||
GMPDecryptorParent::RecvResolvePromise(const uint32_t& aPromiseId)
|
GMPDecryptorParent::RecvResolvePromise(const uint32_t& aPromiseId)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvResolvePromise(promiseId=%u)",
|
||||||
|
this, aPromiseId));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -206,6 +247,9 @@ GMPDecryptorParent::RecvRejectPromise(const uint32_t& aPromiseId,
|
|||||||
const GMPDOMException& aException,
|
const GMPDOMException& aException,
|
||||||
const nsCString& aMessage)
|
const nsCString& aMessage)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvRejectPromise(promiseId=%u, exception=%d, msg='%s')",
|
||||||
|
this, aException, aMessage.get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -219,6 +263,9 @@ GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
|
|||||||
const GMPSessionMessageType& aMessageType,
|
const GMPSessionMessageType& aMessageType,
|
||||||
nsTArray<uint8_t>&& aMessage)
|
nsTArray<uint8_t>&& aMessage)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvSessionMessage(sessionId='%s', type=%d, msg='%s')",
|
||||||
|
this, aSessionId.get(), aMessageType, ToBase64(aMessage).get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -231,6 +278,9 @@ bool
|
|||||||
GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
|
GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
|
||||||
const double& aExpiryTime)
|
const double& aExpiryTime)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)",
|
||||||
|
this, aSessionId.get(), aExpiryTime));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -242,6 +292,9 @@ GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
|
|||||||
bool
|
bool
|
||||||
GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId)
|
GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvSessionClosed(sessionId='%s')",
|
||||||
|
this, aSessionId.get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -256,6 +309,10 @@ GMPDecryptorParent::RecvSessionError(const nsCString& aSessionId,
|
|||||||
const uint32_t& aSystemCode,
|
const uint32_t& aSystemCode,
|
||||||
const nsCString& aMessage)
|
const nsCString& aMessage)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvSessionError(sessionId='%s', exception=%d, sysCode=%d, msg='%s')",
|
||||||
|
this, aSessionId.get(),
|
||||||
|
aException, aSystemCode, aMessage.get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -272,6 +329,9 @@ GMPDecryptorParent::RecvKeyStatusChanged(const nsCString& aSessionId,
|
|||||||
InfallibleTArray<uint8_t>&& aKeyId,
|
InfallibleTArray<uint8_t>&& aKeyId,
|
||||||
const GMPMediaKeyStatus& aStatus)
|
const GMPMediaKeyStatus& aStatus)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvKeyStatusChanged(sessionId='%s', keyId=%s, status=%d)",
|
||||||
|
this, aSessionId.get(), ToBase64(aKeyId).get(), aStatus));
|
||||||
|
|
||||||
if (mIsOpen) {
|
if (mIsOpen) {
|
||||||
mCallback->KeyStatusChanged(aSessionId, aKeyId, aStatus);
|
mCallback->KeyStatusChanged(aSessionId, aKeyId, aStatus);
|
||||||
}
|
}
|
||||||
@ -281,6 +341,8 @@ GMPDecryptorParent::RecvKeyStatusChanged(const nsCString& aSessionId,
|
|||||||
bool
|
bool
|
||||||
GMPDecryptorParent::RecvSetCaps(const uint64_t& aCaps)
|
GMPDecryptorParent::RecvSetCaps(const uint64_t& aCaps)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvSetCaps(caps=0x%llx)", this, aCaps));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -294,6 +356,9 @@ GMPDecryptorParent::RecvDecrypted(const uint32_t& aId,
|
|||||||
const GMPErr& aErr,
|
const GMPErr& aErr,
|
||||||
InfallibleTArray<uint8_t>&& aBuffer)
|
InfallibleTArray<uint8_t>&& aBuffer)
|
||||||
{
|
{
|
||||||
|
LOGV(("GMPDecryptorParent[%p]::RecvDecrypted(id=%d, err=%d)",
|
||||||
|
this, aId, aErr));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
return false;
|
return false;
|
||||||
@ -305,6 +370,8 @@ GMPDecryptorParent::RecvDecrypted(const uint32_t& aId,
|
|||||||
bool
|
bool
|
||||||
GMPDecryptorParent::RecvShutdown()
|
GMPDecryptorParent::RecvShutdown()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::RecvShutdown()", this));
|
||||||
|
|
||||||
Shutdown();
|
Shutdown();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -313,7 +380,9 @@ GMPDecryptorParent::RecvShutdown()
|
|||||||
void
|
void
|
||||||
GMPDecryptorParent::Close()
|
GMPDecryptorParent::Close()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::Close()", this));
|
||||||
MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
|
MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
|
||||||
|
|
||||||
// Consumer is done with us; we can shut down. No more callbacks should
|
// Consumer is done with us; we can shut down. No more callbacks should
|
||||||
// be made to mCallback. Note: do this before Shutdown()!
|
// be made to mCallback. Note: do this before Shutdown()!
|
||||||
mCallback = nullptr;
|
mCallback = nullptr;
|
||||||
@ -328,6 +397,7 @@ GMPDecryptorParent::Close()
|
|||||||
void
|
void
|
||||||
GMPDecryptorParent::Shutdown()
|
GMPDecryptorParent::Shutdown()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::Shutdown()", this));
|
||||||
MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
|
MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
|
||||||
|
|
||||||
if (mShuttingDown) {
|
if (mShuttingDown) {
|
||||||
@ -351,6 +421,8 @@ GMPDecryptorParent::Shutdown()
|
|||||||
void
|
void
|
||||||
GMPDecryptorParent::ActorDestroy(ActorDestroyReason aWhy)
|
GMPDecryptorParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::ActorDestroy(reason=%d)", this, aWhy));
|
||||||
|
|
||||||
mIsOpen = false;
|
mIsOpen = false;
|
||||||
mActorDestroyed = true;
|
mActorDestroyed = true;
|
||||||
if (mCallback) {
|
if (mCallback) {
|
||||||
@ -367,6 +439,8 @@ GMPDecryptorParent::ActorDestroy(ActorDestroyReason aWhy)
|
|||||||
bool
|
bool
|
||||||
GMPDecryptorParent::Recv__delete__()
|
GMPDecryptorParent::Recv__delete__()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPDecryptorParent[%p]::Recv__delete__()", this));
|
||||||
|
|
||||||
if (mPlugin) {
|
if (mPlugin) {
|
||||||
mPlugin->DecryptorDestroyed(this);
|
mPlugin->DecryptorDestroyed(this);
|
||||||
mPlugin = nullptr;
|
mPlugin = nullptr;
|
||||||
|
@ -30,11 +30,6 @@ extern PRLogModuleInfo* GetGMPLog();
|
|||||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
|
#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
|
||||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||||
|
|
||||||
#ifdef __CLASS__
|
|
||||||
#undef __CLASS__
|
|
||||||
#endif
|
|
||||||
#define __CLASS__ "GMPStorageParent"
|
|
||||||
|
|
||||||
namespace gmp {
|
namespace gmp {
|
||||||
|
|
||||||
// We store the records in files in the profile dir.
|
// We store the records in files in the profile dir.
|
||||||
@ -165,7 +160,7 @@ public:
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(!IsOpen(aRecordName));
|
MOZ_ASSERT(!IsOpen(aRecordName));
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
Record* record = nullptr;
|
Record* record = nullptr;
|
||||||
if (!mRecords.Get(aRecordName, &record)) {
|
if (!mRecords.Get(aRecordName, &record)) {
|
||||||
// New file.
|
// New file.
|
||||||
nsAutoString filename;
|
nsAutoString filename;
|
||||||
@ -254,7 +249,7 @@ public:
|
|||||||
return GMPClosedErr;
|
return GMPClosedErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Record* record = nullptr;
|
Record* record = nullptr;
|
||||||
mRecords.Get(aRecordName, &record);
|
mRecords.Get(aRecordName, &record);
|
||||||
MOZ_ASSERT(record && !!record->mFileDesc); // IsOpen() guarantees this.
|
MOZ_ASSERT(record && !!record->mFileDesc); // IsOpen() guarantees this.
|
||||||
|
|
||||||
@ -581,6 +576,8 @@ GMPStorageParent::GMPStorageParent(const nsCString& aNodeId,
|
|||||||
nsresult
|
nsresult
|
||||||
GMPStorageParent::Init()
|
GMPStorageParent::Init()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPStorageParent[%p]::Init()", this));
|
||||||
|
|
||||||
if (NS_WARN_IF(mNodeId.IsEmpty())) {
|
if (NS_WARN_IF(mNodeId.IsEmpty())) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@ -611,6 +608,9 @@ GMPStorageParent::Init()
|
|||||||
bool
|
bool
|
||||||
GMPStorageParent::RecvOpen(const nsCString& aRecordName)
|
GMPStorageParent::RecvOpen(const nsCString& aRecordName)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvOpen(record='%s')",
|
||||||
|
this, aRecordName.get()));
|
||||||
|
|
||||||
if (mShutdown) {
|
if (mShutdown) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -618,23 +618,30 @@ GMPStorageParent::RecvOpen(const nsCString& aRecordName)
|
|||||||
if (mNodeId.EqualsLiteral("null")) {
|
if (mNodeId.EqualsLiteral("null")) {
|
||||||
// Refuse to open storage if the page is opened from local disk,
|
// Refuse to open storage if the page is opened from local disk,
|
||||||
// or shared across origin.
|
// or shared across origin.
|
||||||
NS_WARNING("Refusing to open storage for null NodeId");
|
LOGD(("GMPStorageParent[%p]::RecvOpen(record='%s') failed; null nodeId",
|
||||||
|
this, aRecordName.get()));
|
||||||
unused << SendOpenComplete(aRecordName, GMPGenericErr);
|
unused << SendOpenComplete(aRecordName, GMPGenericErr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aRecordName.IsEmpty()) {
|
if (aRecordName.IsEmpty()) {
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvOpen(record='%s') failed; record name empty",
|
||||||
|
this, aRecordName.get()));
|
||||||
unused << SendOpenComplete(aRecordName, GMPGenericErr);
|
unused << SendOpenComplete(aRecordName, GMPGenericErr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStorage->IsOpen(aRecordName)) {
|
if (mStorage->IsOpen(aRecordName)) {
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvOpen(record='%s') failed; record in use",
|
||||||
|
this, aRecordName.get()));
|
||||||
unused << SendOpenComplete(aRecordName, GMPRecordInUse);
|
unused << SendOpenComplete(aRecordName, GMPRecordInUse);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto err = mStorage->Open(aRecordName);
|
auto err = mStorage->Open(aRecordName);
|
||||||
MOZ_ASSERT(GMP_FAILED(err) || mStorage->IsOpen(aRecordName));
|
MOZ_ASSERT(GMP_FAILED(err) || mStorage->IsOpen(aRecordName));
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvOpen(record='%s') complete; rv=%d",
|
||||||
|
this, aRecordName.get(), err));
|
||||||
unused << SendOpenComplete(aRecordName, err);
|
unused << SendOpenComplete(aRecordName, err);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -643,7 +650,8 @@ GMPStorageParent::RecvOpen(const nsCString& aRecordName)
|
|||||||
bool
|
bool
|
||||||
GMPStorageParent::RecvRead(const nsCString& aRecordName)
|
GMPStorageParent::RecvRead(const nsCString& aRecordName)
|
||||||
{
|
{
|
||||||
LOGD(("%s::%s: %p record=%s", __CLASS__, __FUNCTION__, this, aRecordName.get()));
|
LOGD(("GMPStorageParent[%p]::RecvRead(record='%s')",
|
||||||
|
this, aRecordName.get()));
|
||||||
|
|
||||||
if (mShutdown) {
|
if (mShutdown) {
|
||||||
return false;
|
return false;
|
||||||
@ -651,9 +659,14 @@ GMPStorageParent::RecvRead(const nsCString& aRecordName)
|
|||||||
|
|
||||||
nsTArray<uint8_t> data;
|
nsTArray<uint8_t> data;
|
||||||
if (!mStorage->IsOpen(aRecordName)) {
|
if (!mStorage->IsOpen(aRecordName)) {
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvRead(record='%s') failed; record not open",
|
||||||
|
this, aRecordName.get()));
|
||||||
unused << SendReadComplete(aRecordName, GMPClosedErr, data);
|
unused << SendReadComplete(aRecordName, GMPClosedErr, data);
|
||||||
} else {
|
} else {
|
||||||
unused << SendReadComplete(aRecordName, mStorage->Read(aRecordName, data), data);
|
GMPErr rv = mStorage->Read(aRecordName, data);
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvRead(record='%s') read %d bytes rv=%d",
|
||||||
|
this, aRecordName.get(), data.Length(), rv));
|
||||||
|
unused << SendReadComplete(aRecordName, rv, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -663,23 +676,32 @@ bool
|
|||||||
GMPStorageParent::RecvWrite(const nsCString& aRecordName,
|
GMPStorageParent::RecvWrite(const nsCString& aRecordName,
|
||||||
InfallibleTArray<uint8_t>&& aBytes)
|
InfallibleTArray<uint8_t>&& aBytes)
|
||||||
{
|
{
|
||||||
LOGD(("%s::%s: %p record=%s", __CLASS__, __FUNCTION__, this, aRecordName.get()));
|
LOGD(("GMPStorageParent[%p]::RecvWrite(record='%s') %d bytes",
|
||||||
|
this, aRecordName.get(), aBytes.Length()));
|
||||||
|
|
||||||
if (mShutdown) {
|
if (mShutdown) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mStorage->IsOpen(aRecordName)) {
|
if (!mStorage->IsOpen(aRecordName)) {
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvWrite(record='%s') failed record not open",
|
||||||
|
this, aRecordName.get()));
|
||||||
unused << SendWriteComplete(aRecordName, GMPClosedErr);
|
unused << SendWriteComplete(aRecordName, GMPClosedErr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aBytes.Length() > GMP_MAX_RECORD_SIZE) {
|
if (aBytes.Length() > GMP_MAX_RECORD_SIZE) {
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvWrite(record='%s') failed record too big",
|
||||||
|
this, aRecordName.get()));
|
||||||
unused << SendWriteComplete(aRecordName, GMPQuotaExceededErr);
|
unused << SendWriteComplete(aRecordName, GMPQuotaExceededErr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unused << SendWriteComplete(aRecordName, mStorage->Write(aRecordName, aBytes));
|
GMPErr rv = mStorage->Write(aRecordName, aBytes);
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvWrite(record='%s') write complete rv=%d",
|
||||||
|
this, aRecordName.get(), rv));
|
||||||
|
|
||||||
|
unused << SendWriteComplete(aRecordName, rv);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -687,14 +709,16 @@ GMPStorageParent::RecvWrite(const nsCString& aRecordName,
|
|||||||
bool
|
bool
|
||||||
GMPStorageParent::RecvGetRecordNames()
|
GMPStorageParent::RecvGetRecordNames()
|
||||||
{
|
{
|
||||||
LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, this));
|
|
||||||
|
|
||||||
if (mShutdown) {
|
if (mShutdown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTArray<nsCString> recordNames;
|
nsTArray<nsCString> recordNames;
|
||||||
GMPErr status = mStorage->GetRecordNames(recordNames);
|
GMPErr status = mStorage->GetRecordNames(recordNames);
|
||||||
|
|
||||||
|
LOGD(("GMPStorageParent[%p]::RecvGetRecordNames() status=%d numRecords=%d",
|
||||||
|
this, status, recordNames.Length()));
|
||||||
|
|
||||||
unused << SendRecordNames(recordNames, status);
|
unused << SendRecordNames(recordNames, status);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -703,7 +727,8 @@ GMPStorageParent::RecvGetRecordNames()
|
|||||||
bool
|
bool
|
||||||
GMPStorageParent::RecvClose(const nsCString& aRecordName)
|
GMPStorageParent::RecvClose(const nsCString& aRecordName)
|
||||||
{
|
{
|
||||||
LOGD(("%s::%s: %p record=%s", __CLASS__, __FUNCTION__, this, aRecordName.get()));
|
LOGD(("GMPStorageParent[%p]::RecvClose(record='%s')",
|
||||||
|
this, aRecordName.get()));
|
||||||
|
|
||||||
if (mShutdown) {
|
if (mShutdown) {
|
||||||
return true;
|
return true;
|
||||||
@ -717,14 +742,14 @@ GMPStorageParent::RecvClose(const nsCString& aRecordName)
|
|||||||
void
|
void
|
||||||
GMPStorageParent::ActorDestroy(ActorDestroyReason aWhy)
|
GMPStorageParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||||
{
|
{
|
||||||
LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, this));
|
LOGD(("GMPStorageParent[%p]::ActorDestroy(reason=%d)", this, aWhy));
|
||||||
Shutdown();
|
Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GMPStorageParent::Shutdown()
|
GMPStorageParent::Shutdown()
|
||||||
{
|
{
|
||||||
LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, this));
|
LOGD(("GMPStorageParent[%p]::Shutdown()", this));
|
||||||
|
|
||||||
if (mShutdown) {
|
if (mShutdown) {
|
||||||
return;
|
return;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsLiteralString.h"
|
#include "nsLiteralString.h"
|
||||||
#include "nsCRTGlue.h"
|
#include "nsCRTGlue.h"
|
||||||
|
#include "mozilla/Base64.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
@ -50,4 +51,17 @@ SplitAt(const char* aDelims,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCString
|
||||||
|
ToBase64(const nsTArray<uint8_t>& aBytes)
|
||||||
|
{
|
||||||
|
nsAutoCString base64;
|
||||||
|
nsDependentCSubstring raw(reinterpret_cast<const char*>(aBytes.Elements()),
|
||||||
|
aBytes.Length());
|
||||||
|
nsresult rv = Base64Encode(raw, base64);
|
||||||
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
return NS_LITERAL_CSTRING("[Base64EncodeFailed]");
|
||||||
|
}
|
||||||
|
return base64;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -34,6 +34,9 @@ SplitAt(const char* aDelims,
|
|||||||
const nsACString& aInput,
|
const nsACString& aInput,
|
||||||
nsTArray<nsCString>& aOutTokens);
|
nsTArray<nsCString>& aOutTokens);
|
||||||
|
|
||||||
|
nsCString
|
||||||
|
ToBase64(const nsTArray<uint8_t>& aBytes);
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,6 +23,7 @@ namespace mozilla {
|
|||||||
|
|
||||||
extern PRLogModuleInfo* GetGMPLog();
|
extern PRLogModuleInfo* GetGMPLog();
|
||||||
|
|
||||||
|
#define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg)
|
||||||
#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
|
#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
|
||||||
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ GMPVideoDecoderParent::Host()
|
|||||||
void
|
void
|
||||||
GMPVideoDecoderParent::Close()
|
GMPVideoDecoderParent::Close()
|
||||||
{
|
{
|
||||||
LOGD(("%s: %p", __FUNCTION__, this));
|
LOGD(("GMPVideoDecoderParent[%p]::Close()", this));
|
||||||
MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread());
|
MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread());
|
||||||
|
|
||||||
// Ensure if we've received a Close while waiting for a ResetComplete
|
// Ensure if we've received a Close while waiting for a ResetComplete
|
||||||
@ -92,6 +93,8 @@ GMPVideoDecoderParent::InitDecode(const GMPVideoCodec& aCodecSettings,
|
|||||||
GMPVideoDecoderCallbackProxy* aCallback,
|
GMPVideoDecoderCallbackProxy* aCallback,
|
||||||
int32_t aCoreCount)
|
int32_t aCoreCount)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::InitDecode()", this));
|
||||||
|
|
||||||
if (mActorDestroyed) {
|
if (mActorDestroyed) {
|
||||||
NS_WARNING("Trying to use a destroyed GMP video decoder!");
|
NS_WARNING("Trying to use a destroyed GMP video decoder!");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -123,6 +126,10 @@ GMPVideoDecoderParent::Decode(GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
|
|||||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||||
int64_t aRenderTimeMs)
|
int64_t aRenderTimeMs)
|
||||||
{
|
{
|
||||||
|
LOGV(("GMPVideoDecoderParent[%p]::Decode() timestamp=%lld keyframe=%d",
|
||||||
|
this, aInputFrame->TimeStamp(),
|
||||||
|
aInputFrame->FrameType() == kGMPKeyFrame));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use an dead GMP video decoder");
|
NS_WARNING("Trying to use an dead GMP video decoder");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -158,6 +165,8 @@ GMPVideoDecoderParent::Decode(GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
|
|||||||
nsresult
|
nsresult
|
||||||
GMPVideoDecoderParent::Reset()
|
GMPVideoDecoderParent::Reset()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::Reset()", this));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use an dead GMP video decoder");
|
NS_WARNING("Trying to use an dead GMP video decoder");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -178,6 +187,8 @@ GMPVideoDecoderParent::Reset()
|
|||||||
nsresult
|
nsresult
|
||||||
GMPVideoDecoderParent::Drain()
|
GMPVideoDecoderParent::Drain()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::Drain()", this));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use an dead GMP video decoder");
|
NS_WARNING("Trying to use an dead GMP video decoder");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -211,7 +222,7 @@ GMPVideoDecoderParent::GetDisplayName() const
|
|||||||
nsresult
|
nsresult
|
||||||
GMPVideoDecoderParent::Shutdown()
|
GMPVideoDecoderParent::Shutdown()
|
||||||
{
|
{
|
||||||
LOGD(("%s: %p", __FUNCTION__, this));
|
LOGD(("GMPVideoDecoderParent[%p]::Shutdown()", this));
|
||||||
MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread());
|
MOZ_ASSERT(!mPlugin || mPlugin->GMPThread() == NS_GetCurrentThread());
|
||||||
|
|
||||||
if (mShuttingDown) {
|
if (mShuttingDown) {
|
||||||
@ -242,6 +253,8 @@ GMPVideoDecoderParent::Shutdown()
|
|||||||
void
|
void
|
||||||
GMPVideoDecoderParent::ActorDestroy(ActorDestroyReason aWhy)
|
GMPVideoDecoderParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::ActorDestroy reason=%d", this, aWhy));
|
||||||
|
|
||||||
mIsOpen = false;
|
mIsOpen = false;
|
||||||
mActorDestroyed = true;
|
mActorDestroyed = true;
|
||||||
mVideoHost.DoneWithAPI();
|
mVideoHost.DoneWithAPI();
|
||||||
@ -267,12 +280,17 @@ GMPVideoDecoderParent::ActorDestroy(ActorDestroyReason aWhy)
|
|||||||
bool
|
bool
|
||||||
GMPVideoDecoderParent::RecvDecoded(const GMPVideoi420FrameData& aDecodedFrame)
|
GMPVideoDecoderParent::RecvDecoded(const GMPVideoi420FrameData& aDecodedFrame)
|
||||||
{
|
{
|
||||||
|
LOGV(("GMPVideoDecoderParent[%p]::RecvDecoded() timestamp=%lld",
|
||||||
|
this, aDecodedFrame.mTimestamp()));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GMPVideoi420FrameImpl::CheckFrameData(aDecodedFrame)) {
|
if (!GMPVideoi420FrameImpl::CheckFrameData(aDecodedFrame)) {
|
||||||
LOG(LogLevel::Error, ("%s: Decoded frame corrupt, ignoring", __FUNCTION__));
|
LOG(LogLevel::Error,
|
||||||
|
("GMPVideoDecoderParent[%p]::RecvDecoded() "
|
||||||
|
"timestamp=%lld decoded frame corrupt, ignoring"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto f = new GMPVideoi420FrameImpl(aDecodedFrame, &mVideoHost);
|
auto f = new GMPVideoi420FrameImpl(aDecodedFrame, &mVideoHost);
|
||||||
@ -312,6 +330,8 @@ GMPVideoDecoderParent::RecvReceivedDecodedFrame(const uint64_t& aPictureId)
|
|||||||
bool
|
bool
|
||||||
GMPVideoDecoderParent::RecvInputDataExhausted()
|
GMPVideoDecoderParent::RecvInputDataExhausted()
|
||||||
{
|
{
|
||||||
|
LOGV(("GMPVideoDecoderParent[%p]::RecvInputDataExhausted()", this));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -325,6 +345,8 @@ GMPVideoDecoderParent::RecvInputDataExhausted()
|
|||||||
bool
|
bool
|
||||||
GMPVideoDecoderParent::RecvDrainComplete()
|
GMPVideoDecoderParent::RecvDrainComplete()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::RecvDrainComplete()", this));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -343,6 +365,8 @@ GMPVideoDecoderParent::RecvDrainComplete()
|
|||||||
bool
|
bool
|
||||||
GMPVideoDecoderParent::RecvResetComplete()
|
GMPVideoDecoderParent::RecvResetComplete()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::RecvResetComplete()", this));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -361,6 +385,8 @@ GMPVideoDecoderParent::RecvResetComplete()
|
|||||||
bool
|
bool
|
||||||
GMPVideoDecoderParent::RecvError(const GMPErr& aError)
|
GMPVideoDecoderParent::RecvError(const GMPErr& aError)
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::RecvError(error=%d)", this, aError));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -379,6 +405,8 @@ GMPVideoDecoderParent::RecvError(const GMPErr& aError)
|
|||||||
bool
|
bool
|
||||||
GMPVideoDecoderParent::RecvShutdown()
|
GMPVideoDecoderParent::RecvShutdown()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::RecvShutdown()", this));
|
||||||
|
|
||||||
Shutdown();
|
Shutdown();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -415,6 +443,8 @@ GMPVideoDecoderParent::AnswerNeedShmem(const uint32_t& aFrameBufferSize,
|
|||||||
bool
|
bool
|
||||||
GMPVideoDecoderParent::Recv__delete__()
|
GMPVideoDecoderParent::Recv__delete__()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::Recv__delete__()", this));
|
||||||
|
|
||||||
if (mPlugin) {
|
if (mPlugin) {
|
||||||
// Ignore any return code. It is OK for this to fail without killing the process.
|
// Ignore any return code. It is OK for this to fail without killing the process.
|
||||||
mPlugin->VideoDecoderDestroyed(this);
|
mPlugin->VideoDecoderDestroyed(this);
|
||||||
@ -427,6 +457,8 @@ GMPVideoDecoderParent::Recv__delete__()
|
|||||||
void
|
void
|
||||||
GMPVideoDecoderParent::UnblockResetAndDrain()
|
GMPVideoDecoderParent::UnblockResetAndDrain()
|
||||||
{
|
{
|
||||||
|
LOGD(("GMPVideoDecoderParent[%p]::UnblockResetAndDrain()", this));
|
||||||
|
|
||||||
if (!mCallback) {
|
if (!mCallback) {
|
||||||
MOZ_ASSERT(!mIsAwaitingResetComplete);
|
MOZ_ASSERT(!mIsAwaitingResetComplete);
|
||||||
MOZ_ASSERT(!mIsAwaitingDrainComplete);
|
MOZ_ASSERT(!mIsAwaitingDrainComplete);
|
||||||
|
Loading…
Reference in New Issue
Block a user