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.
master
Roxie Linden 2024-03-30 23:19:38 -07:00
parent 567180508f
commit c6e673cda1
3 changed files with 15 additions and 22 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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;