diff options
author | Roxie Linden <roxie@lindenlab.com> | 2023-09-22 11:22:41 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-08 18:34:01 -0800 |
commit | 1794898563b4b14a46bd385f202b002fee144100 (patch) | |
tree | cff0305668aa5ffe580a8e13228d6c57b7a3aa46 /indra/newview | |
parent | cf72241f97627c59b5d5ab414caf086bffd47dc1 (diff) |
only send volume updates when volume has changed.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.h | 2 |
2 files changed, 12 insertions, 5 deletions
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<llwebrtc::LLWebRTCIceCandidate> mIceCandidates; bool mIceCompleted; + uint32_t mAudioLevel; + bool mIsInitialized; bool mShutdownComplete; |