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

Commit 2a1f3c80 authored by Wonsik Kim's avatar Wonsik Kim Committed by android-build-merger
Browse files

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

am: 7f7052f5

* commit '7f7052f5':
  media: adjust time offset in case of time lapse
parents e9310ba4 7f7052f5
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;