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: Yung Ti Su <andysu@google.com>
diff --git a/media/libaudioprocessing/AudioMixer.cpp b/media/libaudioprocessing/AudioMixer.cpp
index 93ed5f2..045c2c3 100644
--- a/media/libaudioprocessing/AudioMixer.cpp
+++ b/media/libaudioprocessing/AudioMixer.cpp
@@ -204,15 +204,14 @@
 
     // 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.