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

Commit 1a0ecc38 authored by Yung Ti Su's avatar Yung Ti Su
Browse files

AudioMixer: Always do prepareForReformat() in setChannelMasks()



    Always prepareForReformat() when channelmask has changed,
    no matter needing a downmix or not.
    Since ReformatBufferProvider would need to reset when
    channelmask has changed.
    Test: self-tested more then 50 times when a voice call ended
          and there is an incoming Skype/LINE ringtone.
    Bug: 78199280

Test: bug is fixed.
Change-Id: I08c74b00fcbaf8aacef7b1d1c1e840cae347accb
Signed-off-by: default avatarYung Ti Su <andysu@google.com>
parent 527da4c9
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -204,15 +204,14 @@ bool AudioMixer::setChannelMasks(int name,

    // channel masks have changed, does this track need a downmixer?
    // update to try using our desired format (if we aren't already using it)
    const audio_format_t prevDownmixerFormat = track->mDownmixRequiresFormat;
    const status_t status = track->prepareForDownmix();
    ALOGE_IF(status != OK,
            "prepareForDownmix error %d, track channel mask %#x, mixer channel mask %#x",
            status, track->channelMask, track->mMixerChannelMask);

    if (prevDownmixerFormat != track->mDownmixRequiresFormat) {
        track->prepareForReformat(); // because of downmixer, track format may change!
    }
    // always do reformat since channel mask changed,
    // do it after downmix since track format may change!
    track->prepareForReformat();

    if (track->mResampler.get() != nullptr && mixerChannelCountChanged) {
        // resampler channels may have changed.