Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_stream_manager.h" | 5 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <cctype> | 10 #include <cctype> |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 } | 732 } |
| 733 DVLOG(1) << "Enumerate Devices ({label = " << label << "})"; | 733 DVLOG(1) << "Enumerate Devices ({label = " << label << "})"; |
| 734 } | 734 } |
| 735 | 735 |
| 736 void MediaStreamManager::AudioOutputDevicesEnumerated( | 736 void MediaStreamManager::AudioOutputDevicesEnumerated( |
| 737 const AudioOutputDeviceEnumeration& device_enumeration) { | 737 const AudioOutputDeviceEnumeration& device_enumeration) { |
| 738 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 738 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 739 DVLOG(1) << "AudioOutputDevicesEnumerated()"; | 739 DVLOG(1) << "AudioOutputDevicesEnumerated()"; |
| 740 StreamDeviceInfoArray device_infos; | 740 StreamDeviceInfoArray device_infos; |
| 741 | 741 |
| 742 // If the enumeration contains only one entry, it means there are no devices. | 742 if (device_enumeration.has_actual_devices) { |
| 743 // The single entry contains default parameters from the audio manager. | 743 for (const auto& entry : device_enumeration.devices) { |
| 744 if (device_enumeration.size() > 1) { | |
|
tommi (sloooow) - chröme
2016/01/19 13:03:37
instead of the 'has_actual_devices' member variabl
Guido Urdaneta
2016/01/19 13:41:10
devices.size() > 1 is incorrect for AudioManagers
| |
| 745 for (const auto& entry : device_enumeration) { | |
| 746 StreamDeviceInfo device_info(MEDIA_DEVICE_AUDIO_OUTPUT, entry.device_name, | 744 StreamDeviceInfo device_info(MEDIA_DEVICE_AUDIO_OUTPUT, entry.device_name, |
| 747 entry.unique_id); | 745 entry.unique_id); |
| 748 device_infos.push_back(device_info); | 746 device_infos.push_back(device_info); |
| 749 } | 747 } |
| 750 } | 748 } |
| 751 | 749 |
| 752 const std::string log_message = | 750 const std::string log_message = |
| 753 "New device enumeration result:\n" + | 751 "New device enumeration result:\n" + |
| 754 GetLogMessageString(MEDIA_DEVICE_AUDIO_OUTPUT, device_infos); | 752 GetLogMessageString(MEDIA_DEVICE_AUDIO_OUTPUT, device_infos); |
| 755 SendMessageToNativeLog(log_message); | 753 SendMessageToNativeLog(log_message); |
| (...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2073 const std::string& device_guid, | 2071 const std::string& device_guid, |
| 2074 const std::string& raw_unique_id) { | 2072 const std::string& raw_unique_id) { |
| 2075 DCHECK(security_origin.is_valid()); | 2073 DCHECK(security_origin.is_valid()); |
| 2076 DCHECK(!raw_unique_id.empty()); | 2074 DCHECK(!raw_unique_id.empty()); |
| 2077 std::string guid_from_raw_device_id = | 2075 std::string guid_from_raw_device_id = |
| 2078 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); | 2076 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); |
| 2079 return guid_from_raw_device_id == device_guid; | 2077 return guid_from_raw_device_id == device_guid; |
| 2080 } | 2078 } |
| 2081 | 2079 |
| 2082 } // namespace content | 2080 } // namespace content |
| OLD | NEW |