Summary of what this CL does: Existing users can keep using the old ADM for Windows as before. A new ADM for Windows is created and a dedicated factory method is used to create it. The old way (using AudioDeviceImpl) is not utilized. The new ADM is based on a structure where most of the "action" takes place in new AudioInput/AudioOutput implementations. This is inline with our mobile platforms and also makes it easier to break out common parts into a base class. The AudioDevice unittest has always mainly focused on the "Start/Stop"- parts of the ADM and not the complete ADM interface. This new ADM supports all tests in AudioDeviceTest and is therefore tested in combination with the old version. A value-parametrized test us added for Windows builds. Improved readability, threading model and makes the code easier to maintain. Uses the previously landed methods in webrtc::webrtc_win::core_audio_utility. Bug: webrtc:9265 Change-Id: If2894b44528e74a181cf7ad1216f57386ee3a24d Reviewed-on: https://webrtc-review.googlesource.com/78060 Reviewed-by: Oskar Sundbom <ossu@webrtc.org> Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23554}
41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
/*
|
|
* 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"
|
|
|
|
#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
|
|
|
|
#include "rtc_base/logging.h"
|
|
#include "rtc_base/ptr_util.h"
|
|
|
|
namespace webrtc {
|
|
|
|
rtc::scoped_refptr<AudioDeviceModule>
|
|
CreateWindowsCoreAudioAudioDeviceModule() {
|
|
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(
|
|
rtc::MakeUnique<webrtc_win::CoreAudioInput>(),
|
|
rtc::MakeUnique<webrtc_win::CoreAudioOutput>());
|
|
}
|
|
|
|
} // namespace webrtc
|