Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1486)

Side by Side Diff: content/browser/renderer_host/media/audio_output_device_enumerator.cc

Issue 1362093002: Re-land: Add localized default audio device names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Exclude media_resource_provider on iOS. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/media/audio_output_device_enumerator.h" 5 #include "content/browser/renderer_host/media/audio_output_device_enumerator.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "media/audio/audio_manager_base.h" 12 #include "media/audio/audio_manager_base.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 namespace { 16 namespace {
17 17
18 AudioOutputDeviceEnumeration EnumerateDevicesOnDeviceThread( 18 AudioOutputDeviceEnumeration EnumerateDevicesOnDeviceThread(
19 media::AudioManager* audio_manager) { 19 media::AudioManager* audio_manager) {
20 DCHECK(audio_manager->GetWorkerTaskRunner()->BelongsToCurrentThread()); 20 DCHECK(audio_manager->GetWorkerTaskRunner()->BelongsToCurrentThread());
21 21
22 AudioOutputDeviceEnumeration snapshot; 22 AudioOutputDeviceEnumeration snapshot;
23 media::AudioDeviceNames device_names; 23 media::AudioDeviceNames device_names;
24 audio_manager->GetAudioOutputDeviceNames(&device_names); 24 audio_manager->GetAudioOutputDeviceNames(&device_names);
25 25
26 // If no devices in enumeration, return a list with a default device 26 // If no devices in enumeration, return a list with a default device
27 if (device_names.empty()) { 27 if (device_names.empty()) {
28 snapshot.push_back({media::AudioManagerBase::kDefaultDeviceId, 28 snapshot.push_back({media::AudioManagerBase::kDefaultDeviceId,
29 media::AudioManagerBase::kDefaultDeviceName, 29 media::AudioManager::GetDefaultDeviceName(),
30 audio_manager->GetDefaultOutputStreamParameters()}); 30 audio_manager->GetDefaultOutputStreamParameters()});
31 return snapshot; 31 return snapshot;
32 } 32 }
33 33
34 for (const media::AudioDeviceName& name : device_names) { 34 for (const media::AudioDeviceName& name : device_names) {
35 snapshot.push_back( 35 snapshot.push_back(
36 {name.unique_id, name.device_name, 36 {name.unique_id, name.device_name,
37 name.unique_id == media::AudioManagerBase::kDefaultDeviceId 37 name.unique_id == media::AudioManagerBase::kDefaultDeviceId
38 ? audio_manager->GetDefaultOutputStreamParameters() 38 ? audio_manager->GetDefaultOutputStreamParameters()
39 : audio_manager->GetOutputStreamParameters(name.unique_id)}); 39 : audio_manager->GetOutputStreamParameters(name.unique_id)});
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return ++current_event_sequence_; 125 return ++current_event_sequence_;
126 } 126 }
127 127
128 bool AudioOutputDeviceEnumerator::IsLastEnumerationValid() const { 128 bool AudioOutputDeviceEnumerator::IsLastEnumerationValid() const {
129 DCHECK(thread_checker_.CalledOnValidThread()); 129 DCHECK(thread_checker_.CalledOnValidThread());
130 return seq_last_enumeration_ > seq_last_invalidation_ && 130 return seq_last_enumeration_ > seq_last_invalidation_ &&
131 !is_enumeration_ongoing_; 131 !is_enumeration_ongoing_;
132 } 132 }
133 133
134 } // namespace content 134 } // namespace content
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_process_observer.cc ('k') | media/audio/alsa/audio_manager_alsa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698