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

Commit 337885be authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "First step towards renabling Timelapse video recording"

parents a64f5069 08800f3f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1164,7 +1164,7 @@ status_t StagefrightRecorder::setupVideoEncoder(
        // set appropriate level for the software AVCEncoder.
        if ((width * height >= 921600) // 720p
                || (videoBitRate >= 20000000)) {
            enc_meta->setInt32(kKeyVideoLevel, 50);
            enc_meta->setInt32(kKeyVideoLevel, OMX_VIDEO_AVCLevel5);
        }
    }

+6 −1
Original line number Diff line number Diff line
@@ -592,6 +592,11 @@ status_t CameraSource::stop() {
                mLastFrameTimestampUs - mFirstFrameTimeUs);
    }

    if (mNumGlitches > 0) {
        LOGW("%d long delays between neighboring video frames during",
                mNumGlitches);
    }

    CHECK_EQ(mNumFramesReceived, mNumFramesEncoded + mNumFramesDropped);
    return OK;
}
@@ -712,7 +717,7 @@ void CameraSource::dataCallbackTimestamp(int64_t timestampUs,
    if (mNumFramesReceived > 0 &&
        timestampUs - mLastFrameTimestampUs > mGlitchDurationThresholdUs) {
        if (mNumGlitches % 10 == 0) {  // Don't spam the log
            LOGW("Long delay detected in video recording");
            LOGV("Long delay detected in video recording");
        }
        ++mNumGlitches;
    }
+13 −6
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ CameraSourceTimeLapse::CameraSourceTimeLapse(
      mLastTimeLapseFrameRealTimestampUs(0),
      mSkipCurrentFrame(false) {

    LOGV("starting time lapse mode");
    LOGD("starting time lapse mode: %lld us", mTimeBetweenTimeLapseFrameCaptureUs);
    mVideoWidth = videoSize.width;
    mVideoHeight = videoSize.height;

@@ -116,9 +116,9 @@ void CameraSourceTimeLapse::startQuickReadReturns() {
}

bool CameraSourceTimeLapse::trySettingPreviewSize(int32_t width, int32_t height) {
    LOGV("trySettingPreviewSize: %dx%d", width, height);
    int64_t token = IPCThreadState::self()->clearCallingIdentity();
    String8 s = mCamera->getParameters();
    IPCThreadState::self()->restoreCallingIdentity(token);

    CameraParameters params(s);
    Vector<Size> supportedSizes;
@@ -134,17 +134,24 @@ bool CameraSourceTimeLapse::trySettingPreviewSize(int32_t width, int32_t height)
        }
    }

    bool isSuccessful = false;
    if (previewSizeSupported) {
        LOGV("Video size (%d, %d) is a supported preview size", width, height);
        params.setPreviewSize(width, height);
        CHECK(mCamera->setParameters(params.flatten()));
        return true;
        if (mCamera->setParameters(params.flatten()) == OK) {
            isSuccessful = true;
        } else {
            LOGE("Failed to set preview size to %dx%d", width, height);
            isSuccessful = false;
        }
    }

    return false;
    IPCThreadState::self()->restoreCallingIdentity(token);
    return isSuccessful;
}

bool CameraSourceTimeLapse::setPictureSizeToClosestSupported(int32_t width, int32_t height) {
    LOGV("setPictureSizeToClosestSupported: %dx%d", width, height);
    int64_t token = IPCThreadState::self()->clearCallingIdentity();
    String8 s = mCamera->getParameters();
    IPCThreadState::self()->restoreCallingIdentity(token);
@@ -277,7 +284,6 @@ void CameraSourceTimeLapse::startCameraRecording() {

        int64_t token = IPCThreadState::self()->clearCallingIdentity();
        String8 s = mCamera->getParameters();
        IPCThreadState::self()->restoreCallingIdentity(token);

        CameraParameters params(s);
        params.setPictureSize(mPictureWidth, mPictureHeight);
@@ -288,6 +294,7 @@ void CameraSourceTimeLapse::startCameraRecording() {
        // disable shutter sound and play the recording sound.
        mCamera->sendCommand(CAMERA_CMD_ENABLE_SHUTTER_SOUND, 0, 0);
        mCamera->sendCommand(CAMERA_CMD_PLAY_RECORDING_SOUND, 0, 0);
        IPCThreadState::self()->restoreCallingIdentity(token);

        // create a thread which takes pictures in a loop
        pthread_attr_t attr;