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

Commit 7455630f authored by James Dong's avatar James Dong
Browse files

Add more debugging code to track down hang during video recording

bug - 3276561

Change-Id: I1e02590b23031f29bcbfc4a1064f039ed80cb862
parent 41e7e6f9
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -573,7 +573,7 @@ void CameraSource::releaseCamera() {
}

status_t CameraSource::stop() {
    LOGV("stop");
    LOGD("stop: E");
    Mutex::Autolock autoLock(mLock);
    mStarted = false;
    mFrameAvailableCondition.signal();
@@ -581,9 +581,11 @@ status_t CameraSource::stop() {
    int64_t token = IPCThreadState::self()->clearCallingIdentity();
    releaseQueuedFrames();
    while (!mFramesBeingEncoded.empty()) {
        LOGI("Waiting for outstanding frames being encoded: %d",
        if (NO_ERROR !=
            mFrameCompleteCondition.waitRelative(mLock, 3000000000LL)) {
            LOGW("Timed out waiting for outstanding frames being encoded: %d",
                mFramesBeingEncoded.size());
        mFrameCompleteCondition.wait(mLock);
        }
    }
    stopCameraRecording();
    releaseCamera();
@@ -601,6 +603,7 @@ status_t CameraSource::stop() {
    }

    CHECK_EQ(mNumFramesReceived, mNumFramesEncoded + mNumFramesDropped);
    LOGD("stop: X");
    return OK;
}

@@ -666,7 +669,11 @@ status_t CameraSource::read(
    {
        Mutex::Autolock autoLock(mLock);
        while (mStarted && mFramesReceived.empty()) {
            mFrameAvailableCondition.wait(mLock);
            if (NO_ERROR !=
                mFrameAvailableCondition.waitRelative(mLock, 3000000000LL)) {
                LOGW("Timed out waiting for incoming camera video frames: %lld us",
                    mLastFrameTimestampUs);
            }
        }
        if (!mStarted) {
            return OK;
+9 −1
Original line number Diff line number Diff line
@@ -3361,8 +3361,16 @@ status_t OMXCodec::read(
    }

    while (mState != ERROR && !mNoMoreOutputData && mFilledBuffers.empty()) {
        if (mIsEncoder) {
            if (NO_ERROR != mBufferFilled.waitRelative(mLock, 3000000000LL)) {
                LOGW("Timed out waiting for buffers from video encoder: %d/%d",
                    countBuffersWeOwn(mPortBuffers[kPortIndexInput]),
                    countBuffersWeOwn(mPortBuffers[kPortIndexOutput]));
            }
        } else {
            mBufferFilled.wait(mLock);
        }
    }

    if (mState == ERROR) {
        return UNKNOWN_ERROR;