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

Commit 7f7052f5 authored by Wonsik Kim's avatar Wonsik Kim Committed by Android (Google) Code Review
Browse files

Merge "media: adjust time offset in case of time lapse" into nyc-dev

parents fc1337d0 9f5c6923
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1761,12 +1761,16 @@ status_t StagefrightRecorder::resume() {

    // 30 ms buffer to avoid timestamp overlap
    mTotalPausedDurationUs += (systemTime() / 1000) - mPauseStartTimeUs - 30000;
    double timeOffset = -mTotalPausedDurationUs;
    if (mCaptureFpsEnable) {
        timeOffset *= mCaptureFps / mFrameRate;
    }
    if (mAudioEncoderSource != NULL) {
        mAudioEncoderSource->setInputBufferTimeOffset(-mTotalPausedDurationUs);
        mAudioEncoderSource->setInputBufferTimeOffset((int64_t)timeOffset);
        mAudioEncoderSource->start();
    }
    if (mVideoEncoderSource != NULL) {
        mVideoEncoderSource->setInputBufferTimeOffset(-mTotalPausedDurationUs);
        mVideoEncoderSource->setInputBufferTimeOffset((int64_t)timeOffset);
        mVideoEncoderSource->start();
    }
    mPauseStartTimeUs = 0;