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

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

Issue 2313663002: Reland of Add groupid for media devices. Group audio devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve AudioManager comment. Created 4 years, 3 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) 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 <algorithm> 10 #include <algorithm>
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 void MediaStreamManager::AudioOutputDevicesEnumerated( 760 void MediaStreamManager::AudioOutputDevicesEnumerated(
761 const AudioOutputDeviceEnumeration& device_enumeration) { 761 const AudioOutputDeviceEnumeration& device_enumeration) {
762 DCHECK_CURRENTLY_ON(BrowserThread::IO); 762 DCHECK_CURRENTLY_ON(BrowserThread::IO);
763 DVLOG(1) << "AudioOutputDevicesEnumerated()"; 763 DVLOG(1) << "AudioOutputDevicesEnumerated()";
764 StreamDeviceInfoArray device_infos; 764 StreamDeviceInfoArray device_infos;
765 765
766 if (device_enumeration.has_actual_devices) { 766 if (device_enumeration.has_actual_devices) {
767 for (const auto& entry : device_enumeration.devices) { 767 for (const auto& entry : device_enumeration.devices) {
768 StreamDeviceInfo device_info(MEDIA_DEVICE_AUDIO_OUTPUT, entry.device_name, 768 StreamDeviceInfo device_info(MEDIA_DEVICE_AUDIO_OUTPUT, entry.device_name,
769 entry.unique_id); 769 entry.unique_id);
770 device_info.device.group_id = entry.group_id;
770 device_infos.push_back(device_info); 771 device_infos.push_back(device_info);
771 } 772 }
772 } 773 }
773 774
774 const std::string log_message = 775 const std::string log_message =
775 "New device enumeration result:\n" + 776 "New device enumeration result:\n" +
776 GetLogMessageString(MEDIA_DEVICE_AUDIO_OUTPUT, device_infos); 777 GetLogMessageString(MEDIA_DEVICE_AUDIO_OUTPUT, device_infos);
777 SendMessageToNativeLog(log_message); 778 SendMessageToNativeLog(log_message);
778 779
779 // Publish the result for all requests waiting for device list(s). 780 // Publish the result for all requests waiting for device list(s).
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 } 1034 }
1034 1035
1035 void MediaStreamManager::TranslateDeviceIdToSourceId( 1036 void MediaStreamManager::TranslateDeviceIdToSourceId(
1036 DeviceRequest* request, 1037 DeviceRequest* request,
1037 MediaStreamDevice* device) { 1038 MediaStreamDevice* device) {
1038 if (request->audio_type() == MEDIA_DEVICE_AUDIO_CAPTURE || 1039 if (request->audio_type() == MEDIA_DEVICE_AUDIO_CAPTURE ||
1039 request->audio_type() == MEDIA_DEVICE_AUDIO_OUTPUT || 1040 request->audio_type() == MEDIA_DEVICE_AUDIO_OUTPUT ||
1040 request->video_type() == MEDIA_DEVICE_VIDEO_CAPTURE) { 1041 request->video_type() == MEDIA_DEVICE_VIDEO_CAPTURE) {
1041 device->id = GetHMACForMediaDeviceID(request->salt, 1042 device->id = GetHMACForMediaDeviceID(request->salt,
1042 request->security_origin, device->id); 1043 request->security_origin, device->id);
1044 if (!device->group_id.empty())
1045 device->group_id = GetHMACForMediaDeviceID(
1046 request->salt, request->security_origin, device->group_id);
1043 } 1047 }
1044 } 1048 }
1045 1049
1046 void MediaStreamManager::ClearEnumerationCache(EnumerationCache* cache) { 1050 void MediaStreamManager::ClearEnumerationCache(EnumerationCache* cache) {
1047 DCHECK(CalledOnIOThread()); 1051 DCHECK(CalledOnIOThread());
1048 cache->valid = false; 1052 cache->valid = false;
1049 } 1053 }
1050 1054
1051 bool MediaStreamManager::EnumerationRequired(EnumerationCache* cache, 1055 bool MediaStreamManager::EnumerationRequired(EnumerationCache* cache,
1052 MediaStreamType stream_type) { 1056 MediaStreamType stream_type) {
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 if (device_info.session_id == session_id && 2185 if (device_info.session_id == session_id &&
2182 device_info.device.type == type) { 2186 device_info.device.type == type) {
2183 request->SetCapturingLinkSecured(is_secure); 2187 request->SetCapturingLinkSecured(is_secure);
2184 return; 2188 return;
2185 } 2189 }
2186 } 2190 }
2187 } 2191 }
2188 } 2192 }
2189 2193
2190 } // namespace content 2194 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698