Extensive progress logging.
draft
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
--- 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!");