Merge "Revert "audio: Fix remote submix behavior with multiple inputs"" into main am: 829179e29c am: a7845353a1

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

Change-Id: If8e9082a734f180681ef33fa14b1ed6ff7eb99e1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shunkai Yao 2023-12-12 23:59:45 +00:00 committed by Automerger Merge Worker
commit b037083ba2
4 changed files with 9 additions and 9 deletions

View file

@ -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; STEREO; 8000, 11025, 16000, 32000, 44100, 48000
// - profile PCM 16-bit; MONO, 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
// - profile PCM 16-bit; MONO, STEREO; 8000, 11025, 16000, 32000, 44100, 48000
//
// Routes:
// "r_submix output" -> "Remote Submix Out"

View file

@ -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 kMinLatencyMs;
return (kMaxLatencyMs + kMinLatencyMs) / 2;
}
} // namespace aidl::android::hardware::audio::core

View file

@ -73,8 +73,10 @@ std::map<AudioDeviceAddress, std::shared_ptr<SubmixRoute>> StreamRemoteSubmix::s
LOG(ERROR) << __func__ << ": nullptr sink when opening stream";
return ::android::NO_INIT;
}
if ((!mIsInput || mCurrentRoute->isStreamInOpen()) && sink->isShutdown()) {
LOG(DEBUG) << __func__ << ": Shut down sink when opening stream";
// 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 (::android::OK != mCurrentRoute->resetPipe()) {
LOG(ERROR) << __func__ << ": reset pipe failed";
return ::android::NO_INIT;

View file

@ -98,9 +98,6 @@ void SubmixRoute::openStream(bool isInput) {
}
mStreamInStandby = true;
mReadCounterFrames = 0;
if (mSink != nullptr) {
mSink->shutdown(false);
}
} else {
mStreamOutOpen = true;
}
@ -109,7 +106,8 @@ void SubmixRoute::openStream(bool isInput) {
void SubmixRoute::closeStream(bool isInput) {
std::lock_guard guard(mLock);
if (isInput) {
if (--mInputRefCount == 0) {
mInputRefCount--;
if (mInputRefCount == 0) {
mStreamInOpen = false;
if (mSink != nullptr) {
mSink->shutdown(true);