mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
audio: Fix remote submix behavior with multiple inputs
Align the behavior of the new implementation with the legacy implementation in the case when the client opens multiple input streams on the same remote submix device. Reduce the HAL buffer size to match legacy behavior. Bug: 264712385 Test: atest CtsVirtualDevicesTestCases --test-filter=".*VirtualAudioTest.*" Change-Id: Ia86a8480495693595dbb501ec58e5d1d238abab2
This commit is contained in:
@@ -321,9 +321,9 @@ std::unique_ptr<Configuration> getPrimaryConfiguration() {
|
||||
//
|
||||
// Mix ports:
|
||||
// * "r_submix output", maximum 10 opened streams, maximum 10 active streams
|
||||
// - profile PCM 16-bit; MONO, STEREO; 8000, 11025, 16000, 32000, 44100, 48000
|
||||
// - 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; MONO, STEREO; 8000, 11025, 16000, 32000, 44100, 48000
|
||||
// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000
|
||||
//
|
||||
// Routes:
|
||||
// "r_submix output" -> "Remote Submix Out"
|
||||
|
||||
@@ -112,7 +112,7 @@ int32_t ModuleRemoteSubmix::getNominalLatencyMs(const AudioPortConfig&) {
|
||||
static constexpr int32_t kMaxLatencyMs =
|
||||
(r_submix::kDefaultPipeSizeInFrames * 1000) / r_submix::kDefaultSampleRateHz;
|
||||
static constexpr int32_t kMinLatencyMs = kMaxLatencyMs / r_submix::kDefaultPipePeriodCount;
|
||||
return (kMaxLatencyMs + kMinLatencyMs) / 2;
|
||||
return kMinLatencyMs;
|
||||
}
|
||||
|
||||
} // namespace aidl::android::hardware::audio::core
|
||||
|
||||
@@ -73,10 +73,8 @@ std::map<AudioDeviceAddress, std::shared_ptr<SubmixRoute>> StreamRemoteSubmix::s
|
||||
LOG(ERROR) << __func__ << ": nullptr sink when opening stream";
|
||||
return ::android::NO_INIT;
|
||||
}
|
||||
// If the sink has been shutdown or pipe recreation is forced, delete the pipe and
|
||||
// recreate it.
|
||||
if (sink->isShutdown()) {
|
||||
LOG(DEBUG) << __func__ << ": Non-nullptr shut down sink when opening stream";
|
||||
if ((!mIsInput || mCurrentRoute->isStreamInOpen()) && sink->isShutdown()) {
|
||||
LOG(DEBUG) << __func__ << ": Shut down sink when opening stream";
|
||||
if (::android::OK != mCurrentRoute->resetPipe()) {
|
||||
LOG(ERROR) << __func__ << ": reset pipe failed";
|
||||
return ::android::NO_INIT;
|
||||
|
||||
@@ -98,6 +98,9 @@ void SubmixRoute::openStream(bool isInput) {
|
||||
}
|
||||
mStreamInStandby = true;
|
||||
mReadCounterFrames = 0;
|
||||
if (mSink != nullptr) {
|
||||
mSink->shutdown(false);
|
||||
}
|
||||
} else {
|
||||
mStreamOutOpen = true;
|
||||
}
|
||||
@@ -106,8 +109,7 @@ void SubmixRoute::openStream(bool isInput) {
|
||||
void SubmixRoute::closeStream(bool isInput) {
|
||||
std::lock_guard guard(mLock);
|
||||
if (isInput) {
|
||||
mInputRefCount--;
|
||||
if (mInputRefCount == 0) {
|
||||
if (--mInputRefCount == 0) {
|
||||
mStreamInOpen = false;
|
||||
if (mSink != nullptr) {
|
||||
mSink->shutdown(true);
|
||||
|
||||
Reference in New Issue
Block a user