From e1e5d7a3d3d4d6d644e6c731f977422e004140d5 Mon Sep 17 00:00:00 2001 From: Praveen Chavan Date: Tue, 19 May 2015 19:09:48 -0700 Subject: NuPlayer: Enhance dumpsys statistics Account for dropped output-frames (rather than input-frames) in percentage dropped frames. Print mime and component name for each active track Change-Id: I3491d336c696d8ed0fd1503b80afe1df47c787c8 --- .../nuplayer/NuPlayerDecoder.cpp | 42 ++++++++++++++++------ 1 file changed, 31 insertions(+), 11 deletions(-) (limited to 'media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp') diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp index c649c62..99a2a84 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp @@ -58,7 +58,10 @@ NuPlayer::Decoder::Decoder( mCCDecoder(ccDecoder), mSkipRenderingUntilMediaTimeUs(-1ll), mNumFramesTotal(0ll), - mNumFramesDropped(0ll), + mNumInputFramesDropped(0ll), + mNumOutputFramesDropped(0ll), + mVideoWidth(0), + mVideoHeight(0), mIsAudio(true), mIsVideoAVC(false), mIsSecure(false), @@ -77,11 +80,11 @@ NuPlayer::Decoder::~Decoder() { releaseAndResetMediaBuffers(); } -void NuPlayer::Decoder::getStats( - int64_t *numFramesTotal, - int64_t *numFramesDropped) const { - *numFramesTotal = mNumFramesTotal; - *numFramesDropped = mNumFramesDropped; +sp NuPlayer::Decoder::getStats() const { + mStats->setInt64("frames-total", mNumFramesTotal); + mStats->setInt64("frames-dropped-input", mNumInputFramesDropped); + mStats->setInt64("frames-dropped-output", mNumOutputFramesDropped); + return mStats; } void NuPlayer::Decoder::onMessageReceived(const sp &msg) { @@ -237,6 +240,18 @@ void NuPlayer::Decoder::onConfigure(const sp &format) { CHECK_EQ((status_t)OK, mCodec->getOutputFormat(&mOutputFormat)); CHECK_EQ((status_t)OK, mCodec->getInputFormat(&mInputFormat)); + mStats->setString("mime", mime.c_str()); + mStats->setString("component-name", mComponentName.c_str()); + + if (!mIsAudio) { + int32_t width, height; + if (mOutputFormat->findInt32("width", &width) + && mOutputFormat->findInt32("height", &height)) { + mStats->setInt32("width", width); + mStats->setInt32("height", height); + } + } + sp reply = new AMessage(kWhatCodecNotify, this); mCodec->setCallback(reply); @@ -520,6 +535,8 @@ bool NuPlayer::Decoder::handleAnOutputBuffer( mSkipRenderingUntilMediaTimeUs = -1; } + mNumFramesTotal += !mIsAudio; + // wait until 1st frame comes out to signal resume complete notifyResumeCompleteIfNecessary(); @@ -536,6 +553,12 @@ bool NuPlayer::Decoder::handleAnOutputBuffer( void NuPlayer::Decoder::handleOutputFormatChange(const sp &format) { if (!mIsAudio) { + int32_t width, height; + if (format->findInt32("width", &width) + && format->findInt32("height", &height)) { + mStats->setInt32("width", width); + mStats->setInt32("height", height); + } sp notify = mNotify->dup(); notify->setInt32("what", kWhatVideoSizeChanged); notify->setMessage("format", format); @@ -654,10 +677,6 @@ status_t NuPlayer::Decoder::fetchInputData(sp &reply) { return ERROR_END_OF_STREAM; } - if (!mIsAudio) { - ++mNumFramesTotal; - } - dropAccessUnit = false; if (!mIsAudio && !mIsSecure @@ -665,7 +684,7 @@ status_t NuPlayer::Decoder::fetchInputData(sp &reply) { && mIsVideoAVC && !IsAVCReferenceFrame(accessUnit)) { dropAccessUnit = true; - ++mNumFramesDropped; + ++mNumInputFramesDropped; } } while (dropAccessUnit); @@ -833,6 +852,7 @@ void NuPlayer::Decoder::onRenderBuffer(const sp &msg) { CHECK(msg->findInt64("timestampNs", ×tampNs)); err = mCodec->renderOutputBufferAndRelease(bufferIx, timestampNs); } else { + mNumOutputFramesDropped += !mIsAudio; err = mCodec->releaseOutputBuffer(bufferIx); } if (err != OK) { -- cgit v1.1