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

Commit 55ec30f6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "c2SoftAmr: dont discard trailing samples during encoding" into main am:...

Merge "c2SoftAmr: dont discard trailing samples during encoding" into main am: 32325124 am: 84a2ab3e

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/3392606



Change-Id: I31de892a1854268dbc59e7a890dfa636c323969e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1d613942 84a2ab3e
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ void C2SoftAmrNbEnc::process(
        mProcessedSamples * 1000000ll / mIntf->getSampleRate();
    size_t inPos = 0;
    size_t outPos = 0;
    while (inPos < inSize) {
    while (inPos < inSize || eos) {
        const uint8_t *inPtr = rView.data() + inOffset;
        int validSamples = mFilledLen / sizeof(int16_t);
        if ((inPos + (kNumBytesPerInputFrame - mFilledLen)) <= inSize) {
@@ -240,11 +240,10 @@ void C2SoftAmrNbEnc::process(
            memcpy(mInputFrame + validSamples, inPtr + inPos, (inSize - inPos));
            mFilledLen += (inSize - inPos);
            inPos += (inSize - inPos);
            if (eos) {
            if (eos && (mFilledLen > 0)) {
                validSamples = mFilledLen / sizeof(int16_t);
                memset(mInputFrame + validSamples, 0, (kNumBytesPerInputFrame - mFilledLen));
            } else break;

        }
        Frame_Type_3GPP frameType;
        int numEncBytes = AMREncode(mEncState, mSidState, mMode, mInputFrame,
@@ -278,7 +277,6 @@ void C2SoftAmrNbEnc::process(
    if (eos) {
        mSignalledOutputEos = true;
        ALOGV("signalled EOS");
        if (mFilledLen) ALOGV("Discarding trailing %d bytes", mFilledLen);
    }
}

+2 −3
Original line number Diff line number Diff line
@@ -311,7 +311,7 @@ void C2SoftAmrWbEnc::process(
        mProcessedSamples * 1000000ll / mIntf->getSampleRate();
    size_t inPos = 0;
    size_t outPos = 0;
    while (inPos < inSize) {
    while (inPos < inSize || eos) {
        const uint8_t *inPtr = rView.data() + inOffset;
        int validSamples = mFilledLen / sizeof(int16_t);
        if ((inPos + (kNumBytesPerInputFrame - mFilledLen)) <= inSize) {
@@ -322,7 +322,7 @@ void C2SoftAmrWbEnc::process(
            memcpy(mInputFrame + validSamples, inPtr + inPos, (inSize - inPos));
            mFilledLen += (inSize - inPos);
            inPos += (inSize - inPos);
            if (eos) {
            if (eos && (mFilledLen > 0)) {
                validSamples = mFilledLen / sizeof(int16_t);
                memset(mInputFrame + validSamples, 0, (kNumBytesPerInputFrame - mFilledLen));
            } else break;
@@ -352,7 +352,6 @@ void C2SoftAmrWbEnc::process(
    if (eos) {
        mSignalledOutputEos = true;
        ALOGV("signalled EOS");
        if (mFilledLen) ALOGV("Discarding trailing %d bytes", mFilledLen);
    }
}