1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 10:56:22 +00:00
treble_evolution/patches/trebledroid/platform_frameworks_av/0020-voip-Fix-high-pitched-voice-on-Qualcomm-devices.patch
2024-03-10 06:48:11 +00:00

47 lines
2.0 KiB
Diff

From ec4c1dad395b52f59d738379a4c7de387f7334a7 Mon Sep 17 00:00:00 2001
From: ponces <ponces26@gmail.com>
Date: Mon, 24 Oct 2022 09:38:34 +0100
Subject: [PATCH 20/25] 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 d2fcc13b00..fc6cc72c1c 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.25.1