Extensive progress logging. draft
authorRalph Giles <giles@mozilla.com>
Thu, 20 Apr 2017 14:55:34 -0700
changeset 572910 0c3b03d33f9a56ec089c484dd3f44c9f897eb81a
parent 572909 f5dbfdb0ffbd05e62367c9f11b55594350b18355
child 572911 b548312a910a541a37e44117462492865fa04f82
push id57221
push userbmo:giles@thaumas.net
push dateThu, 04 May 2017 22:41:26 +0000
milestone55.0a1
Extensive progress logging. This is helpful for debugging progress while developing the code. It should probably be dropped from the final patch set. MozReview-Commit-ID: AjEjdCzexJh
dom/media/platforms/agnostic/AOMDecoder.cpp
--- a/dom/media/platforms/agnostic/AOMDecoder.cpp
+++ b/dom/media/platforms/agnostic/AOMDecoder.cpp
@@ -45,73 +45,80 @@ InitContext(aom_codec_ctx_t* aCtx,
 
   aom_codec_dec_cfg_t config;
   config.threads = decode_threads;
   config.w = config.h = 0; // set after decode
 
   aom_codec_flags_t flags = 0;
 
   auto res = aom_codec_dec_init(aCtx, dx, &config, flags);
+  LOG_RESULT(res, "aom_codec_dec_init");
   if (res != AOM_CODEC_OK) {
     LOG_RESULT(res, "Codec initialization failed!");
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 AOMDecoder::AOMDecoder(const CreateDecoderParams& aParams)
   : mImageContainer(aParams.mImageContainer)
   , mTaskQueue(aParams.mTaskQueue)
   , mInfo(aParams.VideoConfig())
 {
   MOZ_COUNT_CTOR(AOMDecoder);
   PodZero(&mCodec);
+  LOG("ctor");
 }
 
 AOMDecoder::~AOMDecoder()
 {
   MOZ_COUNT_DTOR(AOMDecoder);
+  LOG("dtor");
 }
 
 RefPtr<ShutdownPromise>
 AOMDecoder::Shutdown()
 {
   RefPtr<AOMDecoder> self = this;
+  LOG("shutting down decoder");
   return InvokeAsync(mTaskQueue, __func__, [self, this]() {
     auto res = aom_codec_destroy(&mCodec);
     if (res != AOM_CODEC_OK) {
       LOG_RESULT(res, "aom_codec_destroy");
     }
     return ShutdownPromise::CreateAndResolve(true, __func__);
   });
 }
 
 RefPtr<MediaDataDecoder::InitPromise>
 AOMDecoder::Init()
 {
+  LOG("initializing decoder");
   if (NS_FAILED(InitContext(&mCodec, mInfo))) {
     return AOMDecoder::InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR,
                                                     __func__);
   }
   return AOMDecoder::InitPromise::CreateAndResolve(TrackInfo::kVideoTrack,
                                                    __func__);
 }
 
 RefPtr<MediaDataDecoder::FlushPromise>
 AOMDecoder::Flush()
 {
+  LOG("flushing decoder");
   return InvokeAsync(mTaskQueue, __func__, []() {
     return FlushPromise::CreateAndResolve(true, __func__);
   });
 }
 
 RefPtr<MediaDataDecoder::DecodePromise>
 AOMDecoder::ProcessDecode(MediaRawData* aSample)
 {
   MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
+  LOG("processing sample");
 
 #if defined(DEBUG)
   NS_ASSERTION(IsKeyframe(*aSample) == aSample->mKeyframe,
                "AOM Decode Keyframe error sample->mKeyframe and si.si_kf out of sync");
 #endif
 
   if (aom_codec_err_t r = aom_codec_decode(&mCodec, aSample->Data(), aSample->Size(), nullptr, 0)) {
     LOG_RESULT(r, "Decode error!");