Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5456e304 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "stagefright: Add more latency profiling"

parents c6446d17 24a7316b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -29,6 +29,13 @@

#define TRACK_BUFFER_TIMING     0

#define CODEC_PLAYER_STATS(func, ...) \
    do { \
        if(mCodec != NULL && mCodec->mMediaExtendedStats != NULL) { \
            mCodec->mMediaExtendedStats->func(__VA_ARGS__);} \
    } \
    while(0)

namespace android {

struct ABuffer;
+3 −0
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@
#define STATS_PROFILE_SET_ENCODER(isVideo) (isVideo != 0 ? "Set video encoder" : "Set audio encoder")
#define STATS_PROFILE_STOP "Stop"
#define STATS_BITRATE "Video Bitrate"
#define STATS_PROFILE_SF_RECORDER_START_LATENCY "\tStagefrightRecorder start latency"
#define STATS_PROFILE_CAMERA_SOURCE_START_LATENCY "\tCamera source start latency"
#define STATS_PROFILE_RECONFIGURE "\tReconfigure latency"

namespace android {

+3 −1
Original line number Diff line number Diff line
@@ -867,7 +867,9 @@ status_t StagefrightRecorder::prepare() {

status_t StagefrightRecorder::start() {
    ALOGV("start");
    ExtendedStats::AutoProfile autoProfile(STATS_PROFILE_START_LATENCY, mRecorderExtendedStats);
    ExtendedStats::AutoProfile autoProfile(
            STATS_PROFILE_SF_RECORDER_START_LATENCY, mRecorderExtendedStats);
    RECORDER_STATS(profileStart, STATS_PROFILE_START_LATENCY);

    if (mOutputFd < 0) {
        ALOGE("Output file descriptor is invalid");
+10 −0
Original line number Diff line number Diff line
@@ -5544,6 +5544,11 @@ bool ACodec::ExecutingState::onOMXEvent(
                mCodec->freeOutputBuffersNotOwnedByComponent();

                mCodec->changeState(mCodec->mOutputPortSettingsChangedState);

                bool isVideo = mCodec->mComponentName.find("video") != -1;
                if (isVideo) {
                    CODEC_PLAYER_STATS(profileStart, STATS_PROFILE_RECONFIGURE);
                }
            } else if (data2 == OMX_IndexConfigCommonOutputCrop) {
                mCodec->mSentFormat = false;
            } else {
@@ -5665,6 +5670,11 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent(

                mCodec->changeState(mCodec->mExecutingState);

                bool isVideo = mCodec->mComponentName.find("video") != -1;
                if (isVideo) {
                    CODEC_PLAYER_STATS(profileStop, STATS_PROFILE_RECONFIGURE);
                }

                return true;
            }

+3 −0
Original line number Diff line number Diff line
@@ -653,6 +653,7 @@ status_t CameraSource::start(MetaData *meta) {
        mRecorderExtendedStats = rStats;
    }

    RECORDER_STATS(profileStart, STATS_PROFILE_CAMERA_SOURCE_START_LATENCY);
    CHECK(!mStarted);
    if (mInitCheck != OK) {
        ALOGE("CameraSource is not initialized yet");
@@ -927,6 +928,8 @@ void CameraSource::dataCallbackTimestamp(int64_t timestampUs,

    mLastFrameTimestampUs = timestampUs;
    if (mNumFramesReceived == 0) {
        RECORDER_STATS(profileStop, STATS_PROFILE_CAMERA_SOURCE_START_LATENCY);
        RECORDER_STATS(profileStop, STATS_PROFILE_START_LATENCY);
        mFirstFrameTimeUs = timestampUs;
        // Initial delay
        if (mStartTimeUs > 0) {
Loading