2018-06-08 16:10:03 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "modules/audio_device/include/audio_device_factory.h"
|
|
|
|
|
|
2019-09-17 17:06:18 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
2018-06-08 16:10:03 +02:00
|
|
|
#if defined(WEBRTC_WIN)
|
|
|
|
|
#include "modules/audio_device/win/audio_device_module_win.h"
|
|
|
|
|
#include "modules/audio_device/win/core_audio_input_win.h"
|
|
|
|
|
#include "modules/audio_device/win/core_audio_output_win.h"
|
|
|
|
|
#include "modules/audio_device/win/core_audio_utility_win.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-04-01 09:16:12 +02:00
|
|
|
#include "api/task_queue/task_queue_factory.h"
|
2018-06-08 16:10:03 +02:00
|
|
|
#include "rtc_base/logging.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2019-04-01 09:16:12 +02:00
|
|
|
rtc::scoped_refptr<AudioDeviceModule> CreateWindowsCoreAudioAudioDeviceModule(
|
2019-07-18 15:17:28 +02:00
|
|
|
TaskQueueFactory* task_queue_factory,
|
|
|
|
|
bool automatic_restart) {
|
2018-09-05 14:34:40 +02:00
|
|
|
RTC_DLOG(INFO) << __FUNCTION__;
|
2019-07-18 15:17:28 +02:00
|
|
|
return CreateWindowsCoreAudioAudioDeviceModuleForTest(task_queue_factory,
|
|
|
|
|
automatic_restart);
|
2018-09-05 14:34:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<AudioDeviceModuleForTest>
|
2019-04-01 09:16:12 +02:00
|
|
|
CreateWindowsCoreAudioAudioDeviceModuleForTest(
|
2019-07-18 15:17:28 +02:00
|
|
|
TaskQueueFactory* task_queue_factory,
|
|
|
|
|
bool automatic_restart) {
|
2018-06-08 16:10:03 +02:00
|
|
|
RTC_DLOG(INFO) << __FUNCTION__;
|
|
|
|
|
// Returns NULL if Core Audio is not supported or if COM has not been
|
|
|
|
|
// initialized correctly using webrtc_win::ScopedCOMInitializer.
|
|
|
|
|
if (!webrtc_win::core_audio_utility::IsSupported()) {
|
|
|
|
|
RTC_LOG(LS_ERROR)
|
|
|
|
|
<< "Unable to create ADM since Core Audio is not supported";
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
return CreateWindowsCoreAudioAudioDeviceModuleFromInputAndOutput(
|
2019-09-17 17:06:18 +02:00
|
|
|
std::make_unique<webrtc_win::CoreAudioInput>(automatic_restart),
|
|
|
|
|
std::make_unique<webrtc_win::CoreAudioOutput>(automatic_restart),
|
2019-07-18 15:17:28 +02:00
|
|
|
task_queue_factory);
|
2018-06-08 16:10:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|