зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1324926 - Convert other EME/GMP byte logging from Base64 to Hex. r=gerald
This is marginly more readable. MozReview-Commit-ID: DWJNFXxI7Vd --HG-- extra : rebase_source : bfc694c51a8f1de28a6a11155f0c3e6b723ff153
This commit is contained in:
Родитель
e0308ca287
Коммит
d71275d786
|
@ -156,7 +156,7 @@ MediaKeySession::UpdateKeyStatusMap()
|
||||||
this, NS_ConvertUTF16toUTF8(mSessionId).get()));
|
this, NS_ConvertUTF16toUTF8(mSessionId).get()));
|
||||||
using IntegerType = typename std::underlying_type<MediaKeyStatus>::type;
|
using IntegerType = typename std::underlying_type<MediaKeyStatus>::type;
|
||||||
for (const CDMCaps::KeyStatus& status : keyStatuses) {
|
for (const CDMCaps::KeyStatus& status : keyStatuses) {
|
||||||
message.Append(nsPrintfCString(" (%s,%s)", ToBase64(status.mId).get(),
|
message.Append(nsPrintfCString(" (%s,%s)", ToHexString(status.mId).get(),
|
||||||
MediaKeyStatusValues::strings[static_cast<IntegerType>(status.mStatus)].value));
|
MediaKeyStatusValues::strings[static_cast<IntegerType>(status.mStatus)].value));
|
||||||
}
|
}
|
||||||
message.Append(" }");
|
message.Append(" }");
|
||||||
|
@ -318,10 +318,10 @@ MediaKeySession::GenerateRequest(const nsAString& aInitDataType,
|
||||||
Telemetry::Accumulate(Telemetry::VIDEO_CDM_GENERATE_REQUEST_CALLED,
|
Telemetry::Accumulate(Telemetry::VIDEO_CDM_GENERATE_REQUEST_CALLED,
|
||||||
ToCDMTypeTelemetryEnum(mKeySystem));
|
ToCDMTypeTelemetryEnum(mKeySystem));
|
||||||
|
|
||||||
// Convert initData to base64 for easier logging.
|
// Convert initData to hex for easier logging.
|
||||||
// Note: CreateSession() 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(ToBase64(data));
|
nsAutoCString hexInitData(ToHexString(data));
|
||||||
PromiseId pid = mKeys->StorePromise(promise);
|
PromiseId pid = mKeys->StorePromise(promise);
|
||||||
mKeys->ConnectPendingPromiseIdWithToken(pid, Token());
|
mKeys->ConnectPendingPromiseIdWithToken(pid, Token());
|
||||||
mKeys->GetCDMProxy()->CreateSession(Token(),
|
mKeys->GetCDMProxy()->CreateSession(Token(),
|
||||||
|
@ -330,11 +330,11 @@ MediaKeySession::GenerateRequest(const nsAString& aInitDataType,
|
||||||
aInitDataType, data);
|
aInitDataType, data);
|
||||||
|
|
||||||
EME_LOG("MediaKeySession[%p,'%s'] GenerateRequest() sent, "
|
EME_LOG("MediaKeySession[%p,'%s'] GenerateRequest() sent, "
|
||||||
"promiseId=%d initData(base64)='%s' initDataType='%s'",
|
"promiseId=%d initData='%s' initDataType='%s'",
|
||||||
this,
|
this,
|
||||||
NS_ConvertUTF16toUTF8(mSessionId).get(),
|
NS_ConvertUTF16toUTF8(mSessionId).get(),
|
||||||
pid,
|
pid,
|
||||||
base64InitData.get(),
|
hexInitData.get(),
|
||||||
NS_ConvertUTF16toUTF8(aInitDataType).get());
|
NS_ConvertUTF16toUTF8(aInitDataType).get());
|
||||||
|
|
||||||
return promise.forget();
|
return promise.forget();
|
||||||
|
@ -447,10 +447,10 @@ MediaKeySession::Update(const ArrayBufferViewOrArrayBuffer& aResponse, ErrorResu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Convert response to base64 for easier logging.
|
// Convert response to hex 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(ToBase64(data));
|
nsAutoCString hexResponse(ToHexString(data));
|
||||||
|
|
||||||
PromiseId pid = mKeys->StorePromise(promise);
|
PromiseId pid = mKeys->StorePromise(promise);
|
||||||
mKeys->GetCDMProxy()->UpdateSession(mSessionId,
|
mKeys->GetCDMProxy()->UpdateSession(mSessionId,
|
||||||
|
@ -458,11 +458,11 @@ MediaKeySession::Update(const ArrayBufferViewOrArrayBuffer& aResponse, ErrorResu
|
||||||
data);
|
data);
|
||||||
|
|
||||||
EME_LOG("MediaKeySession[%p,'%s'] Update() sent to CDM, "
|
EME_LOG("MediaKeySession[%p,'%s'] Update() sent to CDM, "
|
||||||
"promiseId=%d Response(base64)='%s'",
|
"promiseId=%d Response='%s'",
|
||||||
this,
|
this,
|
||||||
NS_ConvertUTF16toUTF8(mSessionId).get(),
|
NS_ConvertUTF16toUTF8(mSessionId).get(),
|
||||||
pid,
|
pid,
|
||||||
base64Response.get());
|
hexResponse.get());
|
||||||
|
|
||||||
return promise.forget();
|
return promise.forget();
|
||||||
}
|
}
|
||||||
|
@ -579,10 +579,10 @@ MediaKeySession::DispatchKeyMessage(MediaKeyMessageType aMessageType,
|
||||||
const nsTArray<uint8_t>& aMessage)
|
const nsTArray<uint8_t>& aMessage)
|
||||||
{
|
{
|
||||||
if (EME_LOG_ENABLED()) {
|
if (EME_LOG_ENABLED()) {
|
||||||
EME_LOG("MediaKeySession[%p,'%s'] DispatchKeyMessage() type=%s message(base64)='%s'",
|
EME_LOG("MediaKeySession[%p,'%s'] DispatchKeyMessage() type=%s message='%s'",
|
||||||
this, NS_ConvertUTF16toUTF8(mSessionId).get(),
|
this, NS_ConvertUTF16toUTF8(mSessionId).get(),
|
||||||
MediaKeyMessageTypeValues::strings[uint32_t(aMessageType)].value,
|
MediaKeyMessageTypeValues::strings[uint32_t(aMessageType)].value,
|
||||||
ToBase64(aMessage).get());
|
ToHexString(aMessage).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<MediaKeyMessageEvent> event(
|
RefPtr<MediaKeyMessageEvent> event(
|
||||||
|
|
|
@ -78,7 +78,7 @@ GMPDecryptorParent::CreateSession(uint32_t aCreateSessionToken,
|
||||||
GMPSessionType aSessionType)
|
GMPSessionType aSessionType)
|
||||||
{
|
{
|
||||||
LOGD(("GMPDecryptorParent[%p]::CreateSession(token=%u, promiseId=%u, aInitData='%s')",
|
LOGD(("GMPDecryptorParent[%p]::CreateSession(token=%u, promiseId=%u, aInitData='%s')",
|
||||||
this, aCreateSessionToken, aPromiseId, ToBase64(aInitData).get()));
|
this, aCreateSessionToken, aPromiseId, ToHexString(aInitData).get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
|
@ -110,7 +110,7 @@ GMPDecryptorParent::UpdateSession(uint32_t aPromiseId,
|
||||||
const nsTArray<uint8_t>& aResponse)
|
const nsTArray<uint8_t>& aResponse)
|
||||||
{
|
{
|
||||||
LOGD(("GMPDecryptorParent[%p]::UpdateSession(sessionId='%s', promiseId=%u response='%s')",
|
LOGD(("GMPDecryptorParent[%p]::UpdateSession(sessionId='%s', promiseId=%u response='%s')",
|
||||||
this, aSessionId.get(), aPromiseId, ToBase64(aResponse).get()));
|
this, aSessionId.get(), aPromiseId, ToHexString(aResponse).get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
|
@ -295,7 +295,7 @@ GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
|
||||||
nsTArray<uint8_t>&& aMessage)
|
nsTArray<uint8_t>&& aMessage)
|
||||||
{
|
{
|
||||||
LOGD(("GMPDecryptorParent[%p]::RecvSessionMessage(sessionId='%s', type=%d, msg='%s')",
|
LOGD(("GMPDecryptorParent[%p]::RecvSessionMessage(sessionId='%s', type=%d, msg='%s')",
|
||||||
this, aSessionId.get(), aMessageType, ToBase64(aMessage).get()));
|
this, aSessionId.get(), aMessageType, ToHexString(aMessage).get()));
|
||||||
|
|
||||||
if (!mIsOpen) {
|
if (!mIsOpen) {
|
||||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||||
|
@ -380,7 +380,7 @@ GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
|
||||||
nsTArray<CDMKeyInfo> cdmKeyInfos(aKeyInfos.Length());
|
nsTArray<CDMKeyInfo> cdmKeyInfos(aKeyInfos.Length());
|
||||||
for (uint32_t i = 0; i < aKeyInfos.Length(); i++) {
|
for (uint32_t i = 0; i < aKeyInfos.Length(); i++) {
|
||||||
LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(keyId=%s, gmp-status=%d)",
|
LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(keyId=%s, gmp-status=%d)",
|
||||||
this, ToBase64(aKeyInfos[i].keyId()).get(), aKeyInfos[i].status()));
|
this, ToHexString(aKeyInfos[i].keyId()).get(), aKeyInfos[i].status()));
|
||||||
// If the status is kGMPUnknown, we're going to forget(remove) that key info.
|
// If the status is kGMPUnknown, we're going to forget(remove) that key info.
|
||||||
if (aKeyInfos[i].status() != kGMPUnknown) {
|
if (aKeyInfos[i].status() != kGMPUnknown) {
|
||||||
auto status = ToMediaKeyStatus(aKeyInfos[i].status());
|
auto status = ToMediaKeyStatus(aKeyInfos[i].status());
|
||||||
|
|
|
@ -52,19 +52,6 @@ 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCString
|
nsCString
|
||||||
ToHexString(const uint8_t * aBytes, uint32_t aLength)
|
ToHexString(const uint8_t * aBytes, uint32_t aLength)
|
||||||
{
|
{
|
||||||
|
@ -85,6 +72,12 @@ ToHexString(const uint8_t * aBytes, uint32_t aLength)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCString
|
||||||
|
ToHexString(const nsTArray<uint8_t>& aBytes)
|
||||||
|
{
|
||||||
|
return ToHexString(aBytes.Elements(), aBytes.Length());
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FileExists(nsIFile* aFile)
|
FileExists(nsIFile* aFile)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,9 +38,9 @@ SplitAt(const char* aDelims,
|
||||||
nsTArray<nsCString>& aOutTokens);
|
nsTArray<nsCString>& aOutTokens);
|
||||||
|
|
||||||
nsCString
|
nsCString
|
||||||
ToBase64(const nsTArray<uint8_t>& aBytes);
|
ToHexString(const nsTArray<uint8_t>& aBytes);
|
||||||
|
|
||||||
static nsCString
|
nsCString
|
||||||
ToHexString(const uint8_t* aBytes, uint32_t aLength);
|
ToHexString(const uint8_t* aBytes, uint32_t aLength);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Загрузка…
Ссылка в новой задаче