Allow native aec to be used in peerconnection_client if available on windows.
Change-Id: Ia0e2e8b5f755602e58c6be75b7ff57ab1e0528fb
Bug: webrtc:8891
Reviewed-on: https://webrtc-review.googlesource.com/53740
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22032}
diff --git a/examples/peerconnection/client/conductor.cc b/examples/peerconnection/client/conductor.cc
index f15e221..214ccfa 100644
--- a/examples/peerconnection/client/conductor.cc
+++ b/examples/peerconnection/client/conductor.cc
@@ -415,18 +415,26 @@
peer_connection_factory_->CreateAudioTrack(
kAudioLabel, peer_connection_factory_->CreateAudioSource(NULL)));
- rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
- peer_connection_factory_->CreateVideoTrack(
- kVideoLabel,
- peer_connection_factory_->CreateVideoSource(OpenVideoCaptureDevice(),
- NULL)));
- main_wnd_->StartLocalRenderer(video_track);
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track;
+ auto video_device(OpenVideoCaptureDevice());
+ if (video_device) {
+ video_track =
+ peer_connection_factory_->CreateVideoTrack(
+ kVideoLabel,
+ peer_connection_factory_->CreateVideoSource(std::move(video_device),
+ NULL));
+ main_wnd_->StartLocalRenderer(video_track);
+ } else {
+ RTC_LOG(LS_ERROR) << "OpenVideoCaptureDevice failed";
+ }
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
peer_connection_factory_->CreateLocalMediaStream(kStreamLabel);
stream->AddTrack(audio_track);
- stream->AddTrack(video_track);
+ if (video_track)
+ stream->AddTrack(video_track);
+
if (!peer_connection_->AddStream(stream)) {
RTC_LOG(LS_ERROR) << "Adding stream to PeerConnection failed";
}
diff --git a/modules/audio_device/win/audio_device_core_win.cc b/modules/audio_device/win/audio_device_core_win.cc
index 834fa4e..4aaefc9 100644
--- a/modules/audio_device/win/audio_device_core_win.cc
+++ b/modules/audio_device/win/audio_device_core_win.cc
@@ -2634,6 +2634,10 @@
return 0;
}
+bool AudioDeviceWindowsCore::BuiltInAECIsAvailable() const {
+ return _dmo != nullptr;
+}
+
// ----------------------------------------------------------------------------
// Playing
// ----------------------------------------------------------------------------
diff --git a/modules/audio_device/win/audio_device_core_win.h b/modules/audio_device/win/audio_device_core_win.h
index b5c2b72..a11849d 100644
--- a/modules/audio_device/win/audio_device_core_win.h
+++ b/modules/audio_device/win/audio_device_core_win.h
@@ -170,6 +170,8 @@
// Delay information and control
virtual int32_t PlayoutDelay(uint16_t& delayMS) const;
+ virtual bool BuiltInAECIsAvailable() const;
+
virtual int32_t EnableBuiltInAEC(bool enable);
public: