Revert "Add remote submix direct paths"

This reverts commit ce9767a966.

Please see the comment on aosp/2832731. This configuration
leads to anomalous framework behavior.

Bug: 311830316
Test: atest audiorouting_tests
Change-Id: I5be3ac18819e297aa199c5a0f5d2e85758448b4b
This commit is contained in:
Mikhail Naganov 2023-12-21 16:10:52 -08:00
parent b80de7bcd7
commit 27719f12e8
2 changed files with 6 additions and 48 deletions

View file

@ -32,7 +32,6 @@ using aidl::android::media::audio::common::AudioDeviceType;
using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
using aidl::android::media::audio::common::AudioGainConfig;
using aidl::android::media::audio::common::AudioInputFlags;
using aidl::android::media::audio::common::AudioIoFlags;
using aidl::android::media::audio::common::AudioOutputFlags;
using aidl::android::media::audio::common::AudioPort;
@ -322,25 +321,20 @@ std::unique_ptr<Configuration> getPrimaryConfiguration() {
//
// Mix ports:
// * "r_submix output", maximum 10 opened streams, maximum 10 active streams
// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000
// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000
// * "r_submix input", maximum 10 opened streams, maximum 10 active streams
// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000
// * "r_submix output direct", DIRECT|IEC958_NONAUDIO, 1 max open, 1 max active
// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000
// * "r_submix input direct", DIRECT, 1 max open, 1 max active
// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000
// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000
//
// Routes:
// "r_submix output", "r_submix output direct" -> "Remote Submix Out"
// "Remote Submix In" -> "r_submix input", "r_submix input direct"
// "r_submix output" -> "Remote Submix Out"
// "Remote Submix In" -> "r_submix input"
//
std::unique_ptr<Configuration> getRSubmixConfiguration() {
static const Configuration configuration = []() {
Configuration c;
const std::vector<AudioProfile> remoteSubmixPcmAudioProfiles{
createProfile(PcmType::INT_16_BIT, {AudioChannelLayout::LAYOUT_STEREO},
{8000, 11025, 16000, 32000, 44100, 48000, 192000})};
{8000, 11025, 16000, 32000, 44100, 48000})};
// Device ports
@ -365,41 +359,13 @@ std::unique_ptr<Configuration> getRSubmixConfiguration() {
rsubmixOutMix.profiles = remoteSubmixPcmAudioProfiles;
c.ports.push_back(rsubmixOutMix);
// Adding a DIRECT flag to rsubmixInMix breaks the mixer paths, so we need separate
// non direct and direct paths. It is added because for IEC61937 encapsulated over PCM, we
// need the DIRECT and IEC958_NONAUDIO flags as AudioFlinger adds them.
AudioPort rsubmixOutDirectMix =
createPort(c.nextPortId++, "r_submix output direct",
makeBitPositionFlagMask({
AudioOutputFlags::DIRECT,
AudioOutputFlags::IEC958_NONAUDIO}),
false /* isInput */,
createPortMixExt(1 /* maxOpenStreamCount */,
1 /* maxActiveStreamCount */));
rsubmixOutDirectMix.profiles = remoteSubmixPcmAudioProfiles;
c.ports.push_back(rsubmixOutDirectMix);
AudioPort rsubmixInMix =
createPort(c.nextPortId++, "r_submix input", 0, true, createPortMixExt(10, 10));
rsubmixInMix.profiles = remoteSubmixPcmAudioProfiles;
c.ports.push_back(rsubmixInMix);
// Adding a DIRECT flag to rsubmixInMix breaks the capture paths, so we need separate
// non direct and direct paths. It is added because for IEC61937 encapsulated over PCM, we
// need the DIRECT flag for the capability so AudioFlinger can find a DIRECT input match.
AudioPort rsubmixInDirectMix =
createPort(c.nextPortId++, "r_submix input direct",
makeBitPositionFlagMask({AudioInputFlags::DIRECT}),
true /* isInput */,
createPortMixExt(1 /* maxOpenStreamCount */,
1 /* maxActiveStreamCount */));
rsubmixInDirectMix.profiles = remoteSubmixPcmAudioProfiles;
c.ports.push_back(rsubmixInDirectMix);
c.routes.push_back(createRoute(
{rsubmixOutMix, rsubmixOutDirectMix}, rsubmixOutDevice));
c.routes.push_back(createRoute({rsubmixOutMix}, rsubmixOutDevice));
c.routes.push_back(createRoute({rsubmixInDevice}, rsubmixInMix));
c.routes.push_back(createRoute({rsubmixInDevice}, rsubmixInDirectMix));
return c;
}();

View file

@ -90,10 +90,6 @@ ndk::ScopedAStatus ModuleRemoteSubmix::setAudioPortConfig(const AudioPortConfig&
ndk::ScopedAStatus ModuleRemoteSubmix::createInputStream(
StreamContext&& context, const SinkMetadata& sinkMetadata,
const std::vector<MicrophoneInfo>& microphones, std::shared_ptr<StreamIn>* result) {
if (context.getFormat().type != AudioFormatType::PCM) {
LOG(DEBUG) << __func__ << ": not supported for format " << context.getFormat().toString();
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
return createStreamInstance<StreamInRemoteSubmix>(result, std::move(context), sinkMetadata,
microphones);
}
@ -101,10 +97,6 @@ ndk::ScopedAStatus ModuleRemoteSubmix::createInputStream(
ndk::ScopedAStatus ModuleRemoteSubmix::createOutputStream(
StreamContext&& context, const SourceMetadata& sourceMetadata,
const std::optional<AudioOffloadInfo>& offloadInfo, std::shared_ptr<StreamOut>* result) {
if (context.getFormat().type != AudioFormatType::PCM) {
LOG(DEBUG) << __func__ << ": not supported for format " << context.getFormat().toString();
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
return createStreamInstance<StreamOutRemoteSubmix>(result, std::move(context), sourceMetadata,
offloadInfo);
}