Merge changes from topic "cuttlefish_aidl_audio-3" into main am: 5f50cd6320

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2889786

Change-Id: I377058af53f2ac65941da6c84deb22d688fd9562
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Mikhail Naganov 2023-12-28 23:32:26 +00:00 committed by Automerger Merge Worker
commit 663f355b7a
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);
}