diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-02-05 16:47:47 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-08 18:37:09 -0800 |
commit | dc1858a32a71e4e944009b206c32112ec846880b (patch) | |
tree | 196034409fbb238c768e57103b24884731e5a84c /indra/llwebrtc/llwebrtc_impl.h | |
parent | 65b5a6e12d32602ae5b0ed3982dc2c74057c7ab7 (diff) |
put observer-based tuning audio level calculation back
Diffstat (limited to 'indra/llwebrtc/llwebrtc_impl.h')
-rw-r--r-- | indra/llwebrtc/llwebrtc_impl.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h index 419482b751..7146267379 100644 --- a/indra/llwebrtc/llwebrtc_impl.h +++ b/indra/llwebrtc/llwebrtc_impl.h @@ -65,6 +65,30 @@ namespace llwebrtc class LLWebRTCPeerConnectionImpl; +class LLAudioDeviceObserver : public webrtc::AudioDeviceDataObserver +{ + public: + LLAudioDeviceObserver(); + + float getMicrophoneEnergy(); + + void OnCaptureData(const void *audio_samples, + const size_t num_samples, + const size_t bytes_per_sample, + const size_t num_channels, + const uint32_t samples_per_sec) override; + + void OnRenderData(const void *audio_samples, + const size_t num_samples, + const size_t bytes_per_sample, + const size_t num_channels, + const uint32_t samples_per_sec) override; + + protected: + float mSumVector[30]; // 300 ms of smoothing + float mMicrophoneEnergy; +}; + class LLCustomProcessor : public webrtc::CustomProcessing { public: @@ -93,7 +117,7 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface, public webrtc::AudioDeviceS { public: LLWebRTCImpl() : - mCustomProcessor(nullptr), mMute(true) + mPeerCustomProcessor(nullptr), mMute(true) { } ~LLWebRTCImpl() {} @@ -190,7 +214,8 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface, public webrtc::AudioDeviceS int32_t mRecordingDevice; bool mMute; - LLCustomProcessor * mCustomProcessor; + LLAudioDeviceObserver * mTuningAudioDeviceObserver; + LLCustomProcessor * mPeerCustomProcessor; // peer connections std::vector<rtc::scoped_refptr<LLWebRTCPeerConnectionImpl>> mPeerConnections; |