webrtc/modules/audio_device/audio_device_name.cc
henrika bb55e0bc72 Clarifies identification of default communication device in ADM2
ADM2 for Windows is based on the CoreAudioUtil class in Chrome.
CoreAudioUtil in Chrome does not use a special string to identify
the Default Communication device but instead a combination of a
string (Default) and a role parameter [1].

When CoreAudioUtil was ported to WebRTC, I accidentally added an
invalid usage of a unique string to identify the default comm device
and it can lead to errors since there are then two different ways to
identify this device. It will also complicate life when we want to
merge changes from Chrome into WebRTC.

This CL removes usage of AudioDeviceName::kDefaultCommunicationsDeviceId
in WebRTC to reduce the risk of errors.

[1] https://cs.chromium.org/chromium/src/media/audio/win/core_audio_util_win.cc?q=core_audio_ut&sq=package:chromium&g=0&l=464

Excluding flaky bot win_x86_msvc_dbg and using Tbr.

Tbr: thaloun@chromium.org
No-Try: True
Bug: webrtc:11107
Change-Id: Ie6687adbe9c3940a217456e4025967f71d86214c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160047
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29848}
2019-11-20 15:02:06 +00:00

26 lines
841 B
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/audio_device_name.h"
#include <utility>
namespace webrtc {
const char AudioDeviceName::kDefaultDeviceId[] = "default";
AudioDeviceName::AudioDeviceName(std::string device_name, std::string unique_id)
: device_name(std::move(device_name)), unique_id(std::move(unique_id)) {}
bool AudioDeviceName::IsValid() {
return !device_name.empty() && !unique_id.empty();
}
} // namespace webrtc