forked from PeterGSI/patches
56 lines
2.7 KiB
Diff
56 lines
2.7 KiB
Diff
From d2fda04e8ad3ff0d3fda168fd41e493e9db54e7a Mon Sep 17 00:00:00 2001
|
|
From: ponces <ponces26@gmail.com>
|
|
Date: Mon, 24 Oct 2022 09:38:34 +0100
|
|
Subject: [PATCH 3/6] voip: Fix high pitched voice on Qualcomm devices
|
|
|
|
Change-Id: I6d314912169776b76d07d8c0301ec5249c1870a2
|
|
---
|
|
.../common/managerdefinitions/src/Serializer.cpp | 12 +++++++++++-
|
|
1 file changed, 11 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
|
index 0f7c903909..c4474cf1c2 100644
|
|
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
|
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
|
|
@@ -252,6 +252,7 @@ private:
|
|
std::string mChannelMasksSeparator = ",";
|
|
std::string mSamplingRatesSeparator = ",";
|
|
std::string mFlagsSeparator = "|";
|
|
+ std::string mMixPortName = "";
|
|
|
|
// Children: ModulesTraits, VolumeTraits, SurroundSoundTraits (optional)
|
|
};
|
|
@@ -426,13 +427,21 @@ PolicySerializer::deserialize<AudioProfileTraits>(
|
|
std::string samplingRates = getXmlAttribute(cur, Attributes::samplingRates);
|
|
std::string format = getXmlAttribute(cur, Attributes::format);
|
|
std::string channels = getXmlAttribute(cur, Attributes::channelMasks);
|
|
+ ChannelTraits::Collection channelsMask = channelMasksFromString(channels, mChannelMasksSeparator.c_str());
|
|
+
|
|
+ // This breaks in-game voice chat and audio in some messaging apps causing it to play with a higher pitch and speed
|
|
+ bool disableStereoVoip = property_get_bool("persist.sys.phh.disable_stereo_voip", false);
|
|
+ if (disableStereoVoip && mMixPortName == "voip_rx") {
|
|
+ ALOGI("%s: disabling stereo support on voip_rx", __func__);
|
|
+ channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ",");
|
|
+ }
|
|
|
|
if (mIgnoreVendorExtensions && maybeVendorExtension(format)) {
|
|
ALOGI("%s: vendor extension format \"%s\" skipped", __func__, format.c_str());
|
|
return NO_INIT;
|
|
}
|
|
AudioProfileTraits::Element profile = new AudioProfile(formatFromString(format, gDynamicFormat),
|
|
- channelMasksFromString(channels, mChannelMasksSeparator.c_str()),
|
|
+ channelsMask,
|
|
samplingRatesFromString(samplingRates, mSamplingRatesSeparator.c_str()));
|
|
|
|
profile->setDynamicFormat(profile->getFormat() == gDynamicFormat);
|
|
@@ -449,6 +458,7 @@ std::variant<status_t, MixPortTraits::Element> PolicySerializer::deserialize<Mix
|
|
using Attributes = MixPortTraits::Attributes;
|
|
|
|
std::string name = getXmlAttribute(child, Attributes::name);
|
|
+ mMixPortName = name;
|
|
if (name.empty()) {
|
|
ALOGE("%s: No %s found", __func__, Attributes::name);
|
|
return BAD_VALUE;
|
|
--
|
|
2.44.0
|
|
|