Commit 6134471c authored by Marina Ciocea's avatar Marina Ciocea Committed by Commit Bot

Use AudioDeviceDescription::IsLoopbackDevice.

Replace duplicate implementation of AudioDeviceDescription::IsLoopbackDevice with function call.

Bug: 783109
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I896038026359723d8fe1c4366cd3a54ddd51e9c1
Reviewed-on: https://chromium-review.googlesource.com/897534Reviewed-by: default avatarMax Morin <maxmorin@chromium.org>
Commit-Queue: Marina Ciocea <marinaciocea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534001}
parent 58b21392
...@@ -219,9 +219,7 @@ AudioInputDelegateImpl::AudioInputDelegateImpl( ...@@ -219,9 +219,7 @@ AudioInputDelegateImpl::AudioInputDelegateImpl(
// Only count for captures from desktop media picker dialog and system loop // Only count for captures from desktop media picker dialog and system loop
// back audio. // back audio.
if (device->type == MEDIA_DESKTOP_AUDIO_CAPTURE && if (device->type == MEDIA_DESKTOP_AUDIO_CAPTURE &&
(device_id == media::AudioDeviceDescription::kLoopbackInputDeviceId || (media::AudioDeviceDescription::IsLoopbackDevice(device_id))) {
device_id ==
media::AudioDeviceDescription::kLoopbackWithMuteDeviceId)) {
IncrementDesktopCaptureCounter(SYSTEM_LOOPBACK_AUDIO_CAPTURER_CREATED); IncrementDesktopCaptureCounter(SYSTEM_LOOPBACK_AUDIO_CAPTURER_CREATED);
} }
} }
......
...@@ -27,9 +27,7 @@ CrasInputStream::CrasInputStream(const AudioParameters& params, ...@@ -27,9 +27,7 @@ CrasInputStream::CrasInputStream(const AudioParameters& params,
stream_id_(0), stream_id_(0),
stream_direction_(CRAS_STREAM_INPUT), stream_direction_(CRAS_STREAM_INPUT),
pin_device_(NO_DEVICE), pin_device_(NO_DEVICE),
is_loopback_( is_loopback_(AudioDeviceDescription::IsLoopbackDevice(device_id)),
device_id == AudioDeviceDescription::kLoopbackInputDeviceId ||
device_id == AudioDeviceDescription::kLoopbackWithMuteDeviceId),
mute_system_audio_(device_id == mute_system_audio_(device_id ==
AudioDeviceDescription::kLoopbackWithMuteDeviceId), AudioDeviceDescription::kLoopbackWithMuteDeviceId),
mute_done_(false) { mute_done_(false) {
......
...@@ -763,8 +763,7 @@ HRESULT WASAPIAudioInputStream::InitializeAudioEngine() { ...@@ -763,8 +763,7 @@ HRESULT WASAPIAudioInputStream::InitializeAudioEngine() {
// Use event-driven mode only fo regular input devices. For loopback the // Use event-driven mode only fo regular input devices. For loopback the
// EVENTCALLBACK flag is specified when intializing // EVENTCALLBACK flag is specified when intializing
// |audio_render_client_for_loopback_|. // |audio_render_client_for_loopback_|.
if (device_id_ == AudioDeviceDescription::kLoopbackInputDeviceId || if (AudioDeviceDescription::IsLoopbackDevice(device_id_)) {
device_id_ == AudioDeviceDescription::kLoopbackWithMuteDeviceId) {
flags = AUDCLNT_STREAMFLAGS_LOOPBACK | AUDCLNT_STREAMFLAGS_NOPERSIST; flags = AUDCLNT_STREAMFLAGS_LOOPBACK | AUDCLNT_STREAMFLAGS_NOPERSIST;
} else { } else {
flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST; flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST;
...@@ -845,8 +844,7 @@ HRESULT WASAPIAudioInputStream::InitializeAudioEngine() { ...@@ -845,8 +844,7 @@ HRESULT WASAPIAudioInputStream::InitializeAudioEngine() {
// samples from the capture endpoint buffer. // samples from the capture endpoint buffer.
// //
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd316551(v=vs.85).aspx // http://msdn.microsoft.com/en-us/library/windows/desktop/dd316551(v=vs.85).aspx
if (device_id_ == AudioDeviceDescription::kLoopbackInputDeviceId || if (AudioDeviceDescription::IsLoopbackDevice(device_id_)) {
device_id_ == AudioDeviceDescription::kLoopbackWithMuteDeviceId) {
hr = endpoint_device_->Activate( hr = endpoint_device_->Activate(
__uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL, __uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL,
&audio_render_client_for_loopback_); &audio_render_client_for_loopback_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment