Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/rtc_peerconnection_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class RTCPeerConnectionFactory : public RefCountInterface {
virtual scoped_refptr<RTCAudioSource> CreateAudioSource(
const string audio_source_label,
RTCAudioSource::SourceType source_type =
RTCAudioSource::SourceType::kMicrophone) = 0;
RTCAudioSource::SourceType::kMicrophone,
RTCAudioOptions options = RTCAudioOptions()) = 0;

virtual scoped_refptr<RTCVideoSource> CreateVideoSource(
scoped_refptr<RTCVideoCapturer> capturer, const string video_source_label,
Expand Down
12 changes: 12 additions & 0 deletions include/rtc_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion src/libwebrtc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ LibWebRTC::CreateRTCPeerConnectionFactory() {
scoped_refptr<RTCPeerConnectionFactory> rtc_peerconnection_factory =
scoped_refptr<RTCPeerConnectionFactory>(
new RefCountedObject<RTCPeerConnectionFactoryImpl>());
rtc_peerconnection_factory->Initialize();
return rtc_peerconnection_factory;
}

Expand Down
12 changes: 9 additions & 3 deletions src/rtc_peerconnection_factory_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,16 @@ RTCPeerConnectionFactoryImpl::CreateAudioSourceWithOptions(
}

scoped_refptr<RTCAudioSource> 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<libwebrtc::LocalAudioSource> rtc_source_track =
CreateAudioSourceWithOptions(&options, source_type == RTCAudioSource::SourceType::kCustom);
CreateAudioSourceWithOptions(
&rtc_options, source_type == RTCAudioSource::SourceType::kCustom);
scoped_refptr<RTCAudioSourceImpl> source = scoped_refptr<RTCAudioSourceImpl>(
new RefCountedObject<RTCAudioSourceImpl>(rtc_source_track, source_type));
return source;
Expand Down
4 changes: 2 additions & 2 deletions src/rtc_peerconnection_factory_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class RTCPeerConnectionFactoryImpl : public RTCPeerConnectionFactory {
scoped_refptr<RTCAudioProcessing> GetAudioProcessing() override;

virtual scoped_refptr<RTCAudioSource> 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<RTCVideoSource> CreateVideoSource(
scoped_refptr<RTCVideoCapturer> capturer, const string video_source_label,
Expand Down
Loading