From 1794898563b4b14a46bd385f202b002fee144100 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 22 Sep 2023 11:22:41 -0700 Subject: only send volume updates when volume has changed. --- indra/newview/llvoicewebrtc.cpp | 15 ++++++++++----- indra/newview/llvoicewebrtc.h | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index e6877063b5..3942f4171d 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2359,12 +2359,17 @@ void LLWebRTCVoiceClient::sendPositionAndVolumeUpdate(void) if (mWebRTCDataInterface && mWebRTCAudioInterface) { - Json::FastWriter writer; - Json::Value root; - root["p"] = (uint32_t) ((F32)mWebRTCDeviceInterface->getAudioLevel() * 256); - std::string json_data = writer.write(root); + uint32_t audio_level = (uint32_t) ((F32) mWebRTCDeviceInterface->getAudioLevel() * 256); + if (audio_level != mAudioLevel) + { + Json::FastWriter writer; + Json::Value root; + root["p"] = (uint32_t) ((F32) mWebRTCDeviceInterface->getAudioLevel() * 256); + std::string json_data = writer.write(root); - mWebRTCDataInterface->sendData(json_data, false); + mWebRTCDataInterface->sendData(json_data, false); + mAudioLevel = audio_level; + } } diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 518fee53ef..e3aa33bfd9 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -786,6 +786,8 @@ private: std::vector mIceCandidates; bool mIceCompleted; + uint32_t mAudioLevel; + bool mIsInitialized; bool mShutdownComplete; -- cgit v1.2.3