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

Commit bfc04e17 authored by Praveen Chavan's avatar Praveen Chavan Committed by Linux Build Service Account
Browse files

Stagefright: Do not skip frames in time-lapse-source for high-speed

Avoid the frame-skip logic in time-lapse source if capture-rate
exceeds video-fps. Not doing so will drop frames and also cause
retrograde timestamps and an assertion in CameraSource.

Also, calculate the TotalPausedDuration value considering the
capturerate and framerate

Change-Id: I8420e44ab96484f0d6301c366a24eefc8efeaf0f
parent 26700a89
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1763,7 +1763,9 @@ status_t StagefrightRecorder::resume() {
    }

    // 30 ms buffer to avoid timestamp overlap
    mTotalPausedDurationUs += (systemTime() / 1000) - mPauseStartTimeUs - 30000;
    mTotalPausedDurationUs +=
        (systemTime() / 1000) - mPauseStartTimeUs -
        (30000 * (mCaptureFpsEnable ? (mCaptureFps / mFrameRate):1));
    double timeOffset = -mTotalPausedDurationUs;
    if (mCaptureFpsEnable) {
        timeOffset *= mCaptureFps / mFrameRate;
+2 −1
Original line number Diff line number Diff line
@@ -281,7 +281,8 @@ bool CameraSourceTimeLapse::skipFrameAndModifyTimeStamp(int64_t *timestampUs) {
    // The first 2 output frames from the encoder are: decoder specific info and
    // the compressed video frame data for the first input video frame.
    if (mNumFramesEncoded >= 1 && *timestampUs <
        (mLastTimeLapseFrameRealTimestampUs + mTimeBetweenFrameCaptureUs)) {
        (mLastTimeLapseFrameRealTimestampUs + mTimeBetweenFrameCaptureUs) &&
        (mTimeBetweenFrameCaptureUs > mTimeBetweenTimeLapseVideoFramesUs + 1)) {
        // Skip all frames from last encoded frame until
        // sufficient time (mTimeBetweenFrameCaptureUs) has passed.
        // Tell the camera to release its recording frame and return.