diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-03-30 23:19:38 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-03-30 23:19:38 -0700 |
commit | c6e673cda139f5faaa52ccd03a372e7ffa9f5716 (patch) | |
tree | 1f743fdb9b737a2b59f0a5c2bf14ebf43b72ceeb | |
parent | 567180508f7279ffd8039d1e839a6ab4e8fe21e9 (diff) |
Fix windows crashes
* sampling rate was set to 8khz for audio processing, which was
causing a 'bands' mismatch with the echo cancler.
* Some funnybusiness with lambdas and captures and such was causing
a heap crash with respect to function parameters.
-rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 32 | ||||
-rw-r--r-- | indra/llwebrtc/llwebrtc.h | 3 | ||||
-rw-r--r-- | indra/llwebrtc/llwebrtc_impl.h | 2 |
3 files changed, 15 insertions, 22 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index a1e125a8f2..074b037529 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -239,16 +239,16 @@ void LLWebRTCImpl::init() webrtc::ProcessingConfig processing_config; processing_config.input_stream().set_num_channels(2); - processing_config.input_stream().set_sample_rate_hz(8000); + processing_config.input_stream().set_sample_rate_hz(48000); processing_config.output_stream().set_num_channels(2); - processing_config.output_stream().set_sample_rate_hz(8000); + processing_config.output_stream().set_sample_rate_hz(48000); processing_config.reverse_input_stream().set_num_channels(2); processing_config.reverse_input_stream().set_sample_rate_hz(48000); processing_config.reverse_output_stream().set_num_channels(2); processing_config.reverse_output_stream().set_sample_rate_hz(48000); - mAudioProcessingModule->Initialize(processing_config); mAudioProcessingModule->ApplyConfig(apm_config); + mAudioProcessingModule->Initialize(processing_config); mPeerConnectionFactory = webrtc::CreatePeerConnectionFactory(mNetworkThread.get(), mWorkerThread.get(), @@ -659,35 +659,27 @@ void LLWebRTCPeerConnectionImpl::unsetSignalingObserver(LLWebRTCSignalingObserve } } -bool LLWebRTCPeerConnectionImpl::initializeConnection(LLWebRTCPeerConnectionInterface::InitOptions options) + +bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnectionInterface::InitOptions& options) { RTC_DCHECK(!mPeerConnection); mAnswerReceived = false; mWebRTCImpl->PostSignalingTask( - [this, options]() + [this,options]() { - std::vector<LLWebRTCPeerConnectionInterface::InitOptions::IceServers> servers = options.mServers; - if(servers.empty()) - { - LLWebRTCPeerConnectionInterface::InitOptions::IceServers ice_servers; - ice_servers.mUrls.push_back("stun:stun.l.google.com:19302"); - ice_servers.mUrls.push_back("stun1:stun.l.google.com:19302"); - ice_servers.mUrls.push_back("stun2:stun.l.google.com:19302"); - ice_servers.mUrls.push_back("stun3:stun.l.google.com:19302"); - ice_servers.mUrls.push_back("stun4:stun.l.google.com:19302"); - } - webrtc::PeerConnectionInterface::RTCConfiguration config; - for (auto server : servers) + for (auto server : options.mServers) { webrtc::PeerConnectionInterface::IceServer ice_server; - ice_server.urls = server.mUrls; + for (auto url : server.mUrls) + { + ice_server.urls.push_back(url); + } ice_server.username = server.mUserName; ice_server.password = server.mPassword; config.servers.push_back(ice_server); } - config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan; config.set_min_port(60000); @@ -718,7 +710,7 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(LLWebRTCPeerConnectionInte cricket::AudioOptions audioOptions; audioOptions.auto_gain_control = true; - audioOptions.echo_cancellation = false; // incompatible with opus stereo + audioOptions.echo_cancellation = true; audioOptions.noise_suppression = true; mLocalStream = mPeerConnectionFactory->CreateLocalMediaStream("SLStream"); diff --git a/indra/llwebrtc/llwebrtc.h b/indra/llwebrtc/llwebrtc.h index f3a33435c9..8830799cde 100644 --- a/indra/llwebrtc/llwebrtc.h +++ b/indra/llwebrtc/llwebrtc.h @@ -227,6 +227,7 @@ class LLWebRTCPeerConnectionInterface { // equivalent of PeerConnectionInterface::IceServer struct IceServers { + // Valid formats are described in RFC7064 and RFC7065. // Urls should containe dns hostnames (not IP addresses) // as the TLS certificate policy is 'secure.' @@ -239,7 +240,7 @@ class LLWebRTCPeerConnectionInterface std::vector<IceServers> mServers; }; - virtual bool initializeConnection(InitOptions options = InitOptions()) = 0; + virtual bool initializeConnection(const InitOptions& options) = 0; virtual bool shutdownConnection() = 0; virtual void setSignalingObserver(LLWebRTCSignalingObserver* observer) = 0; diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h index 32faf2516c..328e962c50 100644 --- a/indra/llwebrtc/llwebrtc_impl.h +++ b/indra/llwebrtc/llwebrtc_impl.h @@ -282,7 +282,7 @@ class LLWebRTCPeerConnectionImpl : public LLWebRTCPeerConnectionInterface, // // LLWebRTCPeerConnection // - bool initializeConnection(InitOptions options = InitOptions()) override; + bool initializeConnection(const InitOptions& options) override; bool shutdownConnection() override; void setSignalingObserver(LLWebRTCSignalingObserver *observer) override; |