1
0
mirror of https://github.com/ponces/treble_aosp.git synced 2024-11-22 05:26:14 +00:00
treble_aosp/patches/trebledroid/platform_frameworks_av/0019-voip-Fix-high-pitched-voice-on-Qualcomm-devices.patch
2024-06-18 10:56:01 +01:00

47 lines
2.0 KiB
Diff

From 4f10be516e736e271a2cd57d50dbffa625f20c1f Mon Sep 17 00:00:00 2001
From: ponces <ponces26@gmail.com>
Date: Mon, 24 Oct 2022 09:38:34 +0100
Subject: [PATCH 19/24] voip: Fix high pitched voice on Qualcomm devices
---
.../common/managerdefinitions/src/Serializer.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
index 146c78b8f6..b9f71cc42b 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)
};
@@ -436,6 +437,13 @@ PolicySerializer::deserialize<AudioProfileTraits>(
channelsMask = channelMasksFromString("AUDIO_CHANNEL_OUT_MONO", ",");
}
+ // 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;
@@ -458,6 +466,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.34.1