3434#include " rtc_base/logging.h"
3535#include " rtc_base/message_digest.h"
3636
37- #if defined(WEBRTC_WIN)
38- #include " modules/audio_device/include/audio_device_factory.h"
39- #include " modules/audio_device/win/core_audio_utility_win.h"
40- #include " rtc_base/win/scoped_com_initializer.h"
41- #endif
42-
4337namespace webrtc {
4438namespace rffi {
4539
@@ -122,10 +116,6 @@ class PeerConnectionFactoryWithOwnedThreads
122116 dependencies.task_queue_factory = CreateDefaultTaskQueueFactory ();
123117 dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>();
124118
125- #if defined(WEBRTC_WIN)
126- std::unique_ptr<ScopedCOMInitializer> com_initializer;
127- #endif
128-
129119 // The audio device module must be created (and destroyed) on the _worker_
130120 // thread. It is safe to release the reference on this thread, however,
131121 // because the PeerConnectionFactory keeps its own reference.
@@ -139,23 +129,6 @@ class PeerConnectionFactoryWithOwnedThreads
139129 return AudioDeviceModule::Create (
140130 AudioDeviceModule::kDummyAudio ,
141131 dependencies.task_queue_factory .get ());
142- case kRffiAudioDeviceModuleDefault :
143- #if defined(WEBRTC_WIN)
144- // Attempt to use the Windows ADM2.
145- com_initializer = std::make_unique<ScopedCOMInitializer>(
146- ScopedCOMInitializer::kMTA );
147- if (com_initializer->Succeeded ()) {
148- return CreateWindowsCoreAudioAudioDeviceModule (
149- dependencies.task_queue_factory .get ());
150- } else {
151- RTC_LOG (LS_WARNING)
152- << " Failed to initialize ScopedCOMInitializer. Will use "
153- " the default ADM." ;
154- }
155- #endif
156- return AudioDeviceModule::Create (
157- AudioDeviceModule::kPlatformDefaultAudio ,
158- dependencies.task_queue_factory .get ());
159132 case kRffiAudioDeviceModuleRingRtc :
160133 return RingRTCAudioDeviceModule::Create (
161134 audio_config_borrowed->rust_adm_borrowed ,
@@ -190,11 +163,7 @@ class PeerConnectionFactoryWithOwnedThreads
190163 auto factory = CreateModularPeerConnectionFactory (std::move (dependencies));
191164 return rtc::make_ref_counted<PeerConnectionFactoryWithOwnedThreads>(
192165 std::move (factory), std::move (network_thread), std::move (worker_thread),
193- std::move (signaling_thread), std::move (injectable_network),
194- #if defined(WEBRTC_WIN)
195- std::move (com_initializer),
196- #endif
197- adm.get ());
166+ std::move (signaling_thread), std::move (injectable_network), adm.get ());
198167 }
199168
200169 ~PeerConnectionFactoryWithOwnedThreads () override {
@@ -297,20 +266,13 @@ class PeerConnectionFactoryWithOwnedThreads
297266 std::unique_ptr<rtc::Thread> owned_worker_thread,
298267 std::unique_ptr<rtc::Thread> owned_signaling_thread,
299268 std::unique_ptr<rffi::InjectableNetwork> injectable_network,
300- #if defined(WEBRTC_WIN)
301- std::unique_ptr<ScopedCOMInitializer> com_initializer,
302- #endif
303269 AudioDeviceModule* audio_device_module)
304270 : owned_network_thread_(std::move(owned_network_thread)),
305271 owned_worker_thread_ (std::move(owned_worker_thread)),
306272 owned_signaling_thread_(std::move(owned_signaling_thread)),
307273 injectable_network_(std::move(injectable_network)),
308- #if defined(WEBRTC_WIN)
309- com_initializer_ (std::move(com_initializer)),
310- #endif
311274 audio_device_module_(audio_device_module),
312- factory_(std::move(factory)) {
313- }
275+ factory_(std::move(factory)) {}
314276
315277 private:
316278 static std::unique_ptr<rtc::Thread> CreateAndStartNetworkThread (
@@ -333,9 +295,6 @@ class PeerConnectionFactoryWithOwnedThreads
333295 const std::unique_ptr<rtc::Thread> owned_worker_thread_;
334296 const std::unique_ptr<rtc::Thread> owned_signaling_thread_;
335297 std::unique_ptr<rffi::InjectableNetwork> injectable_network_;
336- #if defined(WEBRTC_WIN)
337- std::unique_ptr<ScopedCOMInitializer> com_initializer_;
338- #endif
339298 webrtc::AudioDeviceModule* audio_device_module_;
340299 const rtc::scoped_refptr<PeerConnectionFactoryInterface> factory_;
341300};
0 commit comments