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

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

Issue 1602083003: Correctly handle enumerations for AudioManagers that report only the default audio output device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 4 years, 11 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
« no previous file with comments | « content/browser/renderer_host/media/audio_renderer_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) {
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
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
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/audio_renderer_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698