diff --git a/include/rtc_peerconnection_factory.h b/include/rtc_peerconnection_factory.h index 1b6b8c1aec..e9db800255 100644 --- a/include/rtc_peerconnection_factory.h +++ b/include/rtc_peerconnection_factory.h @@ -43,7 +43,8 @@ class RTCPeerConnectionFactory : public RefCountInterface { virtual scoped_refptr CreateAudioSource( const string audio_source_label, RTCAudioSource::SourceType source_type = - RTCAudioSource::SourceType::kMicrophone) = 0; + RTCAudioSource::SourceType::kMicrophone, + RTCAudioOptions options = RTCAudioOptions()) = 0; virtual scoped_refptr CreateVideoSource( scoped_refptr capturer, const string video_source_label, diff --git a/include/rtc_types.h b/include/rtc_types.h index 017386d071..6fd897750b 100644 --- a/include/rtc_types.h +++ b/include/rtc_types.h @@ -108,6 +108,18 @@ struct SdpParseError { enum DesktopType { kScreen, kWindow }; +struct RTCAudioOptions { + RTCAudioOptions() {} + + bool echo_cancellation = true; + + bool auto_gain_control = true; + + bool noise_suppression = true; + + bool highpass_filter = false; +}; + } // namespace libwebrtc #endif // LIB_WEBRTC_RTC_TYPES_HXX diff --git a/src/libwebrtc.cc b/src/libwebrtc.cc index 522c506a3c..b3faaa8ce7 100644 --- a/src/libwebrtc.cc +++ b/src/libwebrtc.cc @@ -34,7 +34,6 @@ LibWebRTC::CreateRTCPeerConnectionFactory() { scoped_refptr rtc_peerconnection_factory = scoped_refptr( new RefCountedObject()); - rtc_peerconnection_factory->Initialize(); return rtc_peerconnection_factory; } diff --git a/src/rtc_peerconnection_factory_impl.cc b/src/rtc_peerconnection_factory_impl.cc index 75d7fa9a42..0346ee5e59 100644 --- a/src/rtc_peerconnection_factory_impl.cc +++ b/src/rtc_peerconnection_factory_impl.cc @@ -203,10 +203,16 @@ RTCPeerConnectionFactoryImpl::CreateAudioSourceWithOptions( } scoped_refptr RTCPeerConnectionFactoryImpl::CreateAudioSource( - const string audio_source_label, RTCAudioSource::SourceType source_type) { - auto options = webrtc::AudioOptions(); + const string audio_source_label, RTCAudioSource::SourceType source_type, + RTCAudioOptions options) { + auto rtc_options = webrtc::AudioOptions(); + rtc_options.echo_cancellation = options.echo_cancellation; + rtc_options.auto_gain_control = options.auto_gain_control; + rtc_options.noise_suppression = options.noise_suppression; + rtc_options.highpass_filter = options.highpass_filter; webrtc::scoped_refptr rtc_source_track = - CreateAudioSourceWithOptions(&options, source_type == RTCAudioSource::SourceType::kCustom); + CreateAudioSourceWithOptions( + &rtc_options, source_type == RTCAudioSource::SourceType::kCustom); scoped_refptr source = scoped_refptr( new RefCountedObject(rtc_source_track, source_type)); return source; diff --git a/src/rtc_peerconnection_factory_impl.h b/src/rtc_peerconnection_factory_impl.h index 49f1d776da..1292806a1e 100644 --- a/src/rtc_peerconnection_factory_impl.h +++ b/src/rtc_peerconnection_factory_impl.h @@ -47,8 +47,8 @@ class RTCPeerConnectionFactoryImpl : public RTCPeerConnectionFactory { scoped_refptr GetAudioProcessing() override; virtual scoped_refptr CreateAudioSource( - const string audio_source_label, - RTCAudioSource::SourceType source_type) override; + const string audio_source_label, RTCAudioSource::SourceType source_type, + RTCAudioOptions options) override; virtual scoped_refptr CreateVideoSource( scoped_refptr capturer, const string video_source_label,