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

Commit d8afd190 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "audio encoders: fix initial timestamp"

parents adb59ecb 353e167d
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ C2SoftAacEnc::C2SoftAacEnc(
      mNumBytesPerInputFrame(0u),
      mOutBufferSize(0u),
      mSentCodecSpecificData(false),
      mInputTimeSet(false),
      mInputSize(0),
      mInputTimeUs(-1ll),
      mSignalledError(false),
@@ -176,6 +177,7 @@ status_t C2SoftAacEnc::initEncoder() {

c2_status_t C2SoftAacEnc::onStop() {
    mSentCodecSpecificData = false;
    mInputTimeSet = false;
    mInputSize = 0u;
    mInputTimeUs = -1ll;
    mSignalledError = false;
@@ -193,6 +195,7 @@ void C2SoftAacEnc::onRelease() {

c2_status_t C2SoftAacEnc::onFlush_sm() {
    mSentCodecSpecificData = false;
    mInputTimeSet = false;
    mInputSize = 0u;
    return C2_OK;
}
@@ -337,7 +340,6 @@ void C2SoftAacEnc::process(

        mOutBufferSize = encInfo.maxOutBufBytes;
        mNumBytesPerInputFrame = encInfo.frameLength * channelCount * sizeof(int16_t);
        mInputTimeUs = work->input.ordinal.timestamp;

        mSentCodecSpecificData = true;
    }
@@ -351,6 +353,10 @@ void C2SoftAacEnc::process(
        data = view.data();
        capacity = view.capacity();
    }
    if (!mInputTimeSet && capacity > 0) {
        mInputTimeUs = work->input.ordinal.timestamp;
        mInputTimeSet = true;
    }

    size_t numFrames = (capacity + mInputSize + (eos ? mNumBytesPerInputFrame - 1 : 0))
            / mNumBytesPerInputFrame;
@@ -550,6 +556,7 @@ c2_status_t C2SoftAacEnc::drain(

    (void)pool;
    mSentCodecSpecificData = false;
    mInputTimeSet = false;
    mInputSize = 0u;

    // TODO: we don't have any pending work at this time to drain.
+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ private:
    UINT mOutBufferSize;

    bool mSentCodecSpecificData;
    bool mInputTimeSet;
    size_t mInputSize;
    c2_cntr64_t mInputTimeUs;

+1 −1
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ void C2SoftAmrNbEnc::process(
        mFilledLen = 0;
    }
    ALOGV("causal sample size %d", mFilledLen);
    if (mIsFirst) {
    if (mIsFirst && outPos != 0) {
        mIsFirst = false;
        mAnchorTimeStamp = work->input.ordinal.timestamp.peekull();
    }
+1 −1
Original line number Diff line number Diff line
@@ -347,7 +347,7 @@ void C2SoftAmrWbEnc::process(
        mFilledLen = 0;
    }
    ALOGV("causal sample size %d", mFilledLen);
    if (mIsFirst) {
    if (mIsFirst && outPos != 0) {
        mIsFirst = false;
        mAnchorTimeStamp = work->input.ordinal.timestamp.peekull();
    }
+1 −1
Original line number Diff line number Diff line
@@ -350,7 +350,7 @@ void C2SoftOpusEnc::process(const std::unique_ptr<C2Work>& work,
            return;
        }
    }
    if (mIsFirstFrame) {
    if (mIsFirstFrame && inSize > 0) {
        mAnchorTimeStamp = work->input.ordinal.timestamp.peekull();
        mIsFirstFrame = false;
    }