webrtc_m130/modules/audio_device/include/audio_device_factory.h
henrika 5b6afc0ce6 Adds stream-switch support in new Windows ADM.
Second round of the new Windows ADM is now ready for review. Main
changes are:

Supports internal (automatic) restart of audio streams when an active
audio stream disconnects (happens when a device is removed).

Adds support for IAudioClient3 and IAudioClient2 for platforms which
supports it (>Win8 and >Win10).

Modifies the threading model to support restart "from the inside" on
the native audio thread.

Adds two new test methods for the ADM to emulate restart events or
stream-switch events.

Adds two new test methods to support rate conversion to ensure that
audio can be tested in loopback even if devices runs at different
sample rates.

Added initial components for low-latency support. Verified that it works
but disabled it with a flag for now.

Bug: webrtc:9265
Change-Id: Ia8e577daabea6b433f2c2eabab4e46ce8added6a
Reviewed-on: https://webrtc-review.googlesource.com/86020
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24578}
2018-09-05 13:04:01 +00:00

44 lines
1.5 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.
*/
#ifndef MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_FACTORY_H_
#define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_FACTORY_H_
#include "modules/audio_device/include/audio_device.h"
namespace webrtc {
// Creates an AudioDeviceModule (ADM) for Windows based on the Core Audio API.
// The creating thread must be a COM thread; otherwise nullptr will be returned.
// Example (assuming webrtc namespace):
//
// public:
// rtc::scoped_refptr<AudioDeviceModule> CreateAudioDevice() {
// // Tell COM that this thread shall live in the MTA.
// com_initializer_ = absl::make_unique<webrtc_win::ScopedCOMInitializer>(
// webrtc_win::ScopedCOMInitializer::kMTA);
// if (!com_initializer_->Succeeded()) {
// return nullptr;
// }
// return CreateWindowsCoreAudioAudioDeviceModule();
// }
//
// private:
// std::unique_ptr<webrtc_win::ScopedCOMInitializer> com_initializer_;
//
rtc::scoped_refptr<AudioDeviceModule> CreateWindowsCoreAudioAudioDeviceModule();
rtc::scoped_refptr<AudioDeviceModuleForTest>
CreateWindowsCoreAudioAudioDeviceModuleForTest();
} // namespace webrtc
#endif // MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_FACTORY_H_