Bug 1351132 - Fix keystatus and decode logging in ChromiumCDMChild. r?gerald
MozReview-Commit-ID: xwfJ4WwbmN
--- a/dom/media/gmp/ChromiumCDMChild.cpp
+++ b/dom/media/gmp/ChromiumCDMChild.cpp
@@ -8,16 +8,17 @@
#include "WidevineUtils.h"
#include "WidevineFileIO.h"
#include "WidevineVideoFrame.h"
#include "GMPLog.h"
#include "GMPPlatform.h"
#include "mozilla/Unused.h"
#include "nsPrintfCString.h"
#include "base/time.h"
+#include "GMPUtils.h"
namespace mozilla {
namespace gmp {
ChromiumCDMChild::ChromiumCDMChild(GMPContentChild* aPlugin)
: mPlugin(aPlugin)
{
MOZ_ASSERT(IsOnMessageLoopThread());
@@ -149,25 +150,21 @@ ChromiumCDMChild::OnSessionMessage(const
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);
+ const cdm::KeyInformation& key = aKeysInfo[i];
+ str.Append(ToHexString(key.key_id, key.key_id_size));
str.AppendLiteral("=");
str.AppendInt(key.status);
}
return str;
}
void
ChromiumCDMChild::OnSessionKeysChange(const char *aSessionId,
@@ -504,34 +501,36 @@ ChromiumCDMChild::RecvResetVideoDecoder(
Unused << SendResetVideoDecoderComplete();
return IPC_OK();
}
mozilla::ipc::IPCResult
ChromiumCDMChild::RecvDecryptAndDecodeFrame(const CDMInputBuffer& aBuffer)
{
MOZ_ASSERT(IsOnMessageLoopThread());
- GMP_LOG("ChromiumCDMChild::RecvDecryptAndDecodeFrame()");
+ GMP_LOG("ChromiumCDMChild::RecvDecryptAndDecodeFrame() t=%" PRId64 ")",
+ aBuffer.mTimestamp());
MOZ_ASSERT(mDecoderInitialized);
// The output frame may not have the same timestamp as the frame we put in.
// We may need to input a number of frames before we receive output. The
// CDM's decoder reorders to ensure frames output are in presentation order.
// So we need to store the durations of the frames input, and retrieve them
// on output.
mFrameDurations.Insert(aBuffer.mTimestamp(), aBuffer.mDuration());
cdm::InputBuffer input;
nsTArray<cdm::SubsampleEntry> subsamples;
InitInputBuffer(aBuffer, subsamples, input);
WidevineVideoFrame frame;
cdm::Status rv = mCDM->DecryptAndDecodeFrame(input, &frame);
- GMP_LOG("WidevineVideoDecoder::Decode(timestamp=%" PRId64 ") rv=%d",
- input.timestamp,
+ GMP_LOG("ChromiumCDMChild::RecvDecryptAndDecodeFrame() t=%" PRId64
+ " CDM decoder rv=%d",
+ aBuffer.mTimestamp(),
rv);
switch (rv) {
case cdm::kNoKey:
GMP_LOG("NoKey for sample at time=%" PRId64 "!", input.timestamp);
// Somehow our key became unusable. Typically this would happen when
// a stream requires output protection, and the configuration changed
// such that output protection is no longer available. For example, a