Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/media_devices_manager.h" | 5 #include "content/browser/renderer_host/media/media_devices_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 output_string += " " + device_info.label + "\n"; | 48 output_string += " " + device_info.label + "\n"; |
| 49 return output_string; | 49 return output_string; |
| 50 } | 50 } |
| 51 | 51 |
| 52 MediaDeviceInfoArray EnumerateAudioDevicesOnDeviceThread( | 52 MediaDeviceInfoArray EnumerateAudioDevicesOnDeviceThread( |
| 53 media::AudioManager* audio_manager, | 53 media::AudioManager* audio_manager, |
| 54 bool is_input) { | 54 bool is_input) { |
| 55 DCHECK(audio_manager->GetTaskRunner()->BelongsToCurrentThread()); | 55 DCHECK(audio_manager->GetTaskRunner()->BelongsToCurrentThread()); |
| 56 | 56 |
| 57 MediaDeviceInfoArray snapshot; | 57 MediaDeviceInfoArray snapshot; |
| 58 media::AudioDeviceNames device_names; | 58 media::AudioDeviceDescriptions device_descriptions; |
| 59 if (is_input) | 59 if (is_input) |
| 60 audio_manager->GetAudioInputDeviceNames(&device_names); | 60 audio_manager->GetAudioInputDeviceDescriptions(&device_descriptions); |
| 61 else | 61 else |
| 62 audio_manager->GetAudioOutputDeviceNames(&device_names); | 62 audio_manager->GetAudioOutputDeviceDescriptions(&device_descriptions); |
| 63 | 63 |
| 64 for (const media::AudioDeviceName& name : device_names) { | 64 for (const media::AudioDeviceDescription& description : device_descriptions) |
|
DaleCurtis
2016/12/12 22:13:44
Does snapshot.insert(snapshot.end(), device_descri
o1ka
2016/12/13 09:33:58
No, unless we have a conversion from AudioDeviceDe
DaleCurtis
2016/12/13 20:16:48
I was hoping the insert() operator would be smart
| |
| 65 snapshot.emplace_back( | 65 snapshot.emplace_back(description); |
| 66 name.unique_id, name.device_name, | |
| 67 is_input ? audio_manager->GetGroupIDInput(name.unique_id) | |
| 68 : audio_manager->GetGroupIDOutput(name.unique_id)); | |
| 69 } | |
| 70 | 66 |
| 71 return snapshot; | 67 return snapshot; |
| 72 } | 68 } |
| 73 | 69 |
| 74 MediaDeviceInfoArray GetFakeAudioDevices(bool is_input) { | 70 MediaDeviceInfoArray GetFakeAudioDevices(bool is_input) { |
| 75 MediaDeviceInfoArray result; | 71 MediaDeviceInfoArray result; |
| 76 if (is_input) { | 72 if (is_input) { |
| 77 result.emplace_back(media::AudioDeviceDescription::kDefaultDeviceId, | 73 result.emplace_back(media::AudioDeviceDescription::kDefaultDeviceId, |
| 78 "Fake Default Audio Input", | 74 "Fake Default Audio Input", |
| 79 "fake_group_audio_input_default"); | 75 "fake_group_audio_input_default"); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 const MediaDeviceInfoArray& snapshot) { | 520 const MediaDeviceInfoArray& snapshot) { |
| 525 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 521 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 526 DCHECK(IsValidMediaDeviceType(type)); | 522 DCHECK(IsValidMediaDeviceType(type)); |
| 527 | 523 |
| 528 for (const auto& subscriber : device_change_subscribers_[type]) { | 524 for (const auto& subscriber : device_change_subscribers_[type]) { |
| 529 subscriber->OnDevicesChanged(type, snapshot); | 525 subscriber->OnDevicesChanged(type, snapshot); |
| 530 } | 526 } |
| 531 } | 527 } |
| 532 | 528 |
| 533 } // namespace content | 529 } // namespace content |
| OLD | NEW |