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

Commit 51dde7a6 authored by Zhou Song's avatar Zhou Song Committed by Steve Kondik
Browse files

AudioMixer: fill 0s at right place when no more buffers available

When mixer format is PCM_FLOAT and only a partial buffer available
at the end of playback, 0s can be filled at the beginning of the
mixer buffer which will overwrite the copied buffers, then glitch
is heard.

This is because OutPointer is not updated and the pointer always keeps
the start position of mixer buffer when mixer format is PCM_FLOAT.

Assign the value of 'fout' to 'out' to make sure 'out' holds the
current copy position.

CRs-Fixed: 872775

Change-Id: I50504c5a02eb0c69abfc9b047792b0f6f85b9ce8
parent c69b0a34
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1849,6 +1849,9 @@ void AudioMixer::process__OneTrack16BitsStereoNoResampling(state_t* state,
                // Note: In case of later int16_t sink output,
                // conversion and clamping is done by memcpy_to_i16_from_float().
            } while (--outFrames);
            // assign fout to out, when no more frames are available, so that 0s
            // can be filled at the right place
            out = (int32_t *)fout;
            break;
        case AUDIO_FORMAT_PCM_16_BIT:
            if (CC_UNLIKELY(uint32_t(vl) > UNITY_GAIN_INT || uint32_t(vr) > UNITY_GAIN_INT)) {