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

Commit b5d11959 authored by Yung Ti Su's avatar Yung Ti Su
Browse files

AudioMixer: recreate Resampler if the track channel count has changed

the Resampler is recreated only if mixer channel count has changed.
I removed the criteria since resampler need recreation when
track channel count has changed.
This issue is due to the previous resampler still working with
the previous channel mask settings.
Test: self-tested more then 50 times when a voice call ended
          and there is an incoming Skype/LINE ringtone.
Bug: 78199280

Change-Id: I042fb9214d07f198704cef3c96bf290c7d203461
parent 7bb4333f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -192,7 +192,6 @@ bool AudioMixer::setChannelMasks(int name,
    // always recompute for both channel masks even if only one has changed.
    const uint32_t trackChannelCount = audio_channel_count_from_out_mask(trackChannelMask);
    const uint32_t mixerChannelCount = audio_channel_count_from_out_mask(mixerChannelMask);
    const bool mixerChannelCountChanged = track->mMixerChannelCount != mixerChannelCount;

    ALOG_ASSERT((trackChannelCount <= MAX_NUM_CHANNELS_TO_DOWNMIX)
            && trackChannelCount
@@ -213,7 +212,7 @@ bool AudioMixer::setChannelMasks(int name,
    // do it after downmix since track format may change!
    track->prepareForReformat();

    if (track->mResampler.get() != nullptr && mixerChannelCountChanged) {
    if (track->mResampler.get() != nullptr) {
        // resampler channels may have changed.
        const uint32_t resetToSampleRate = track->sampleRate;
        track->mResampler.reset(nullptr);