Ensures that ADM unittest uses default audio devices for all platforms.

TBR=ossu

Bug: webrtc:9265
Change-Id: Ifc6d3f9c5c4a4e31dcedfd72ed96a2bde5d074e7
Reviewed-on: https://webrtc-review.googlesource.com/101262
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24786}
This commit is contained in:
henrika
2018-09-21 14:53:10 +02:00
committed by Commit Bot
parent 645512ba59
commit 5773ad3bc8

View File

@ -47,6 +47,14 @@ using ::testing::Mock;
namespace webrtc {
namespace {
// Using a #define for AUDIO_DEVICE since we will call *different* versions of
// the ADM functions, depending on the ID type.
#if defined(WEBRTC_WIN)
#define AUDIO_DEVICE_ID (AudioDeviceModule::WindowsDeviceType::kDefaultDevice)
#else
#define AUDIO_DEVICE_ID (0u)
#endif // defined(WEBRTC_WIN)
// #define ENABLE_DEBUG_PRINTF
#ifdef ENABLE_DEBUG_PRINTF
#define PRINTD(...) fprintf(stderr, __VA_ARGS__);
@ -520,12 +528,12 @@ class AudioDeviceTest
requirements_satisfied_ = false;
#endif
if (requirements_satisfied_) {
EXPECT_EQ(0, audio_device_->SetPlayoutDevice(0));
EXPECT_EQ(0, audio_device_->SetPlayoutDevice(AUDIO_DEVICE_ID));
EXPECT_EQ(0, audio_device_->InitSpeaker());
EXPECT_EQ(0, audio_device_->SetRecordingDevice(0));
EXPECT_EQ(0, audio_device_->InitMicrophone());
EXPECT_EQ(0, audio_device_->StereoPlayoutIsAvailable(&stereo_playout_));
EXPECT_EQ(0, audio_device_->SetStereoPlayout(stereo_playout_));
EXPECT_EQ(0, audio_device_->SetRecordingDevice(AUDIO_DEVICE_ID));
EXPECT_EQ(0, audio_device_->InitMicrophone());
// Avoid asking for input stereo support and always record in mono
// since asking can cause issues in combination with remote desktop.
// See https://bugs.chromium.org/p/webrtc/issues/detail?id=7397 for