summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSujin Panicker <quic_c_spanic@quicinc.com>2023-05-16 18:28:08 +0530
committerSujin Panicker <quic_c_spanic@quicinc.com>2023-06-23 12:04:40 +0530
commit03bee649bd326acb31ea509f95d28b09e6f44402 (patch)
treea0305e0485d507892cf4a575b18627405d0fb74c
parent556650d7a8c2f0f8a3a2c4a7e6133989925740bb (diff)
audioflinger: Normalize FrameCount for duplicating thread
Duplicate output calculates frame count based on its corresponding peripheral HAL parameters rather than the Primary Audio HAL. However, this may lead to underruns in primary AHAL, where the Duplicating output frame count does not meet the min frame count required by AudioMixer for primary AHAL. Change is to normalize mNormalFrameCount based on the minimum frames expected by AudioMixer. CRs-Fixed: 3536120 Change-Id: I6fc46cad7f3c20e8f2352451c7946e7acbe70dea
-rw-r--r--services/audioflinger/Threads.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index a52b766712..bdfa39d3fe 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2968,6 +2968,7 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l()
{
// unfortunately we have no way of recovering from errors here, hence the LOG_ALWAYS_FATAL
const audio_config_base_t audioConfig = mOutput->getAudioProperties();
+ bool isDup = false;
mSampleRate = audioConfig.sample_rate;
mChannelMask = audioConfig.channel_mask;
if (!audio_is_output_channel(mChannelMask)) {
@@ -3050,10 +3051,14 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l()
// This may need to be updated as MixerThread/OutputTracks are added and not here.
}
+ if (property_get_bool("vendor.audio.gaming.enabled", false /* default_value */) &&
+ mType == DUPLICATING) {
+ isDup = true;
+ }
// Calculate size of normal sink buffer relative to the HAL output buffer size
double multiplier = 1.0;
// Note: mType == SPATIALIZER does not support FastMixer.
- if (mType == MIXER && (kUseFastMixer == FastMixer_Static ||
+ if ((mType == MIXER || isDup) && (kUseFastMixer == FastMixer_Static ||
kUseFastMixer == FastMixer_Dynamic)) {
size_t minNormalFrameCount = (kMinNormalSinkBufferSizeMs * mSampleRate) / 1000;
size_t maxNormalFrameCount = (kMaxNormalSinkBufferSizeMs * mSampleRate) / 1000;