Audio : Add remote submix stream implementation
Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ia477458193ade9068eaf56e953ab670fee53cc7d
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index 6f89d4b..48d1458 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -27,6 +27,7 @@
#include "core-impl/Bluetooth.h"
#include "core-impl/Module.h"
+#include "core-impl/ModuleRemoteSubmix.h"
#include "core-impl/ModuleUsb.h"
#include "core-impl/SoundDose.h"
#include "core-impl/StreamStub.h"
@@ -111,8 +112,9 @@
switch (type) {
case Module::Type::USB:
return ndk::SharedRefBase::make<ModuleUsb>(type);
- case Type::DEFAULT:
case Type::R_SUBMIX:
+ return ndk::SharedRefBase::make<ModuleRemoteSubmix>(type);
+ case Type::DEFAULT:
default:
return ndk::SharedRefBase::make<Module>(type);
}
@@ -181,8 +183,8 @@
StreamContext temp(
std::make_unique<StreamContext::CommandMQ>(1, true /*configureEventFlagWord*/),
std::make_unique<StreamContext::ReplyMQ>(1, true /*configureEventFlagWord*/),
- portConfigIt->format.value(), portConfigIt->channelMask.value(),
- portConfigIt->sampleRate.value().value, flags,
+ portConfigIt->portId, portConfigIt->format.value(),
+ portConfigIt->channelMask.value(), portConfigIt->sampleRate.value().value, flags,
portConfigIt->ext.get<AudioPortExt::mix>().handle,
std::make_unique<StreamContext::DataMQ>(frameSize * in_bufferSizeFrames),
asyncCallback, outEventCallback, params);
@@ -490,6 +492,17 @@
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
}
+ for (auto profile : connectedPort.profiles) {
+ if (profile.channelMasks.empty()) {
+ LOG(ERROR) << __func__ << ": the profile " << profile.name << " has no channel masks";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ if (profile.sampleRates.empty()) {
+ LOG(ERROR) << __func__ << ": the profile " << profile.name << " has no sample rates";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ }
+
connectedPort.id = ++getConfig().nextPortId;
auto [connectedPortsIt, _] =
mConnectedDevicePorts.insert(std::pair(connectedPort.id, std::vector<int32_t>()));