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

Commit a82797fa authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: add fallback for output selection

When getOutputForDevice() finds a matching direct output profile
but fails to open it, try to fallback to downmix on mixer output
when format is PCM and sampling rate allows it.

Bug: 19197137.
Change-Id: I197b9b202504265b6928e69740875cb7aba5c2c5
parent a93fd2be
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1098,6 +1098,10 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
            if (output != AUDIO_IO_HANDLE_NONE) {
                mpClientInterface->closeOutput(output);
            }
            // fall back to mixer output if possible when the direct output could not be open
            if (audio_is_linear_pcm(format) && samplingRate <= MAX_MIXER_SAMPLING_RATE) {
                goto non_direct_output;
            }
            return AUDIO_IO_HANDLE_NONE;
        }
        outputDesc->mSamplingRate = config.sample_rate;