Bug 1221991 - [4.2] Add AndroidDecoderModule logging. r=snorp

This commit is contained in:
Eugen Sawin 2015-11-10 21:39:48 +01:00
parent 803336e4c9
commit 50957b1e3a
2 changed files with 31 additions and 0 deletions

View File

@ -18,8 +18,24 @@
#include "nsAutoPtr.h"
#include "nsPromiseFlatString.h"
#include "prlog.h"
#include <jni.h>
static PRLogModuleInfo* AndroidDecoderModuleLog()
{
static PRLogModuleInfo* sLogModule = nullptr;
if (!sLogModule) {
sLogModule = PR_NewLogModule("AndroidDecoderModule");
}
return sLogModule;
}
#undef LOG
#define LOG(arg, ...) MOZ_LOG(AndroidDecoderModuleLog(), \
mozilla::LogLevel::Debug, ("AndroidDecoderModule(%p)::%s: " arg, \
this, __func__, ##__VA_ARGS__))
using namespace mozilla;
using namespace mozilla::gl;
using namespace mozilla::widget::sdk;
@ -680,6 +696,17 @@ MediaCodecDataDecoder::DecoderLoop()
mMonitor.Notify();
}
const char*
MediaCodecDataDecoder::ModuleStateStr(ModuleState aState) {
static const char* kStr[] = {
"Decoding", "Flushing", "DrainQueue", "DrainDecoder", "DrainWaitEOS",
"Stopping", "Shutdown"
};
MOZ_ASSERT(aState < sizeof(kStr) / sizeof(kStr[0]));
return kStr[aState];
}
MediaCodecDataDecoder::ModuleState
MediaCodecDataDecoder::State() const
{
@ -689,6 +716,8 @@ MediaCodecDataDecoder::State() const
void
MediaCodecDataDecoder::State(ModuleState aState)
{
LOG("%s -> %s", ModuleStateStr(mState), ModuleStateStr(aState));
if (aState == kDrainDecoder) {
MOZ_ASSERT(mState == kDrainQueue);
} else if (aState == kDrainWaitEOS) {

View File

@ -71,6 +71,8 @@ protected:
friend class AndroidDecoderModule;
static const char* ModuleStateStr(ModuleState aState);
virtual nsresult InitDecoder(widget::sdk::Surface::Param aSurface);
virtual nsresult Output(widget::sdk::BufferInfo::Param aInfo, void* aBuffer,