Bug 1186406 - Log why GMPVideoDecoderParent::Decode() fails. r=gerald
authorChris Pearce <cpearce@mozilla.com>
Tue, 01 Dec 2015 18:13:52 +1300
changeset 309001 39cbbf8f1c0ae776822ebf3800b69c4c9e1c7fa2
parent 309000 aad04db89c38a569fdd57519ff453acd39ab6816
child 309002 4ec205ad08157abb71b492a10e423de4e971770e
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1186406
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1186406 - Log why GMPVideoDecoderParent::Decode() fails. r=gerald This helps us to identify the cause of such failures.
dom/media/gmp/GMPVideoDecoderParent.cpp
--- a/dom/media/gmp/GMPVideoDecoderParent.cpp
+++ b/dom/media/gmp/GMPVideoDecoderParent.cpp
@@ -20,16 +20,17 @@ namespace mozilla {
 #ifdef LOG
 #undef LOG
 #endif
 
 extern LogModule* GetGMPLog();
 
 #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg)
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
+#define LOGE(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Error, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 namespace gmp {
 
 // States:
 // Initial: mIsOpen == false
 //    on InitDecode success -> Open
 //    on Shutdown -> Dead
@@ -127,40 +128,44 @@ GMPVideoDecoderParent::Decode(GMPUniqueP
                               const nsTArray<uint8_t>& aCodecSpecificInfo,
                               int64_t aRenderTimeMs)
 {
   LOGV(("GMPVideoDecoderParent[%p]::Decode() timestamp=%lld keyframe=%d",
         this, aInputFrame->TimeStamp(),
         aInputFrame->FrameType() == kGMPKeyFrame));
 
   if (!mIsOpen) {
+    LOGE(("GMPVideoDecoderParent[%p]::Decode() ERROR; dead GMPVideoDecoder", this));
     NS_WARNING("Trying to use an dead GMP video decoder");
     return NS_ERROR_FAILURE;
   }
 
   MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
 
   GMPUniquePtr<GMPVideoEncodedFrameImpl> inputFrameImpl(
     static_cast<GMPVideoEncodedFrameImpl*>(aInputFrame.release()));
 
   // Very rough kill-switch if the plugin stops processing.  If it's merely
   // hung and continues, we'll come back to life eventually.
   // 3* is because we're using 3 buffers per frame for i420 data for now.
   if ((NumInUse(GMPSharedMem::kGMPFrameData) > 3*GMPSharedMem::kGMPBufLimit) ||
       (NumInUse(GMPSharedMem::kGMPEncodedData) > GMPSharedMem::kGMPBufLimit)) {
+    LOGE(("GMPVideoDecoderParent[%p]::Decode() ERROR; shmem buffer limit hit frame=%d encoded=%d",
+          this, NumInUse(GMPSharedMem::kGMPFrameData), NumInUse(GMPSharedMem::kGMPEncodedData)));
     return NS_ERROR_FAILURE;
   }
 
   GMPVideoEncodedFrameData frameData;
   inputFrameImpl->RelinquishFrameData(frameData);
 
   if (!SendDecode(frameData,
                   aMissingFrames,
                   aCodecSpecificInfo,
                   aRenderTimeMs)) {
+    LOGE(("GMPVideoDecoderParent[%p]::Decode() ERROR; SendDecode() failure.", this));
     return NS_ERROR_FAILURE;
   }
   mFrameCount++;
 
   // Async IPC, we don't have access to a return value.
   return NS_OK;
 }
 
@@ -304,18 +309,17 @@ GMPVideoDecoderParent::RecvDecoded(const
   LOGV(("GMPVideoDecoderParent[%p]::RecvDecoded() timestamp=%lld frameCount=%d",
     this, aDecodedFrame.mTimestamp(), mFrameCount));
 
   if (!mCallback) {
     return false;
   }
 
   if (!GMPVideoi420FrameImpl::CheckFrameData(aDecodedFrame)) {
-    LOG(LogLevel::Error,
-      ("GMPVideoDecoderParent[%p]::RecvDecoded() "
+    LOGE(("GMPVideoDecoderParent[%p]::RecvDecoded() "
        "timestamp=%lld decoded frame corrupt, ignoring"));
     return false;
   }
   auto f = new GMPVideoi420FrameImpl(aDecodedFrame, &mVideoHost);
 
   // Ignore any return code. It is OK for this to fail without killing the process.
   mCallback->Decoded(f);
 
@@ -453,18 +457,18 @@ GMPVideoDecoderParent::AnswerNeedShmem(c
                                        Shmem* aMem)
 {
   ipc::Shmem mem;
 
   if (!mVideoHost.SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPFrameData,
                                                 aFrameBufferSize,
                                                 ipc::SharedMemory::TYPE_BASIC, &mem))
   {
-    LOG(LogLevel::Error, ("%s: Failed to get a shared mem buffer for Child! size %u",
-                       __FUNCTION__, aFrameBufferSize));
+    LOGE(("%s: Failed to get a shared mem buffer for Child! size %u",
+         __FUNCTION__, aFrameBufferSize));
     return false;
   }
   *aMem = mem;
   mem = ipc::Shmem();
   return true;
 }
 
 bool