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

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

Issue 2273653002: Add groupid for media devices. Group audio devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test. 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 =
771 audio_manager_->GetGroupIDOutput(device_info.device.id);
770 device_infos.push_back(device_info); 772 device_infos.push_back(device_info);
771 } 773 }
772 } 774 }
773 775
774 const std::string log_message = 776 const std::string log_message =
775 "New device enumeration result:\n" + 777 "New device enumeration result:\n" +
776 GetLogMessageString(MEDIA_DEVICE_AUDIO_OUTPUT, device_infos); 778 GetLogMessageString(MEDIA_DEVICE_AUDIO_OUTPUT, device_infos);
777 SendMessageToNativeLog(log_message); 779 SendMessageToNativeLog(log_message);
778 780
779 // Publish the result for all requests waiting for device list(s). 781 // Publish the result for all requests waiting for device list(s).
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 } 1035 }
1034 1036
1035 void MediaStreamManager::TranslateDeviceIdToSourceId( 1037 void MediaStreamManager::TranslateDeviceIdToSourceId(
1036 DeviceRequest* request, 1038 DeviceRequest* request,
1037 MediaStreamDevice* device) { 1039 MediaStreamDevice* device) {
1038 if (request->audio_type() == MEDIA_DEVICE_AUDIO_CAPTURE || 1040 if (request->audio_type() == MEDIA_DEVICE_AUDIO_CAPTURE ||
1039 request->audio_type() == MEDIA_DEVICE_AUDIO_OUTPUT || 1041 request->audio_type() == MEDIA_DEVICE_AUDIO_OUTPUT ||
1040 request->video_type() == MEDIA_DEVICE_VIDEO_CAPTURE) { 1042 request->video_type() == MEDIA_DEVICE_VIDEO_CAPTURE) {
1041 device->id = GetHMACForMediaDeviceID(request->salt, 1043 device->id = GetHMACForMediaDeviceID(request->salt,
1042 request->security_origin, device->id); 1044 request->security_origin, device->id);
1045 DCHECK(!device->group_id.empty());
1046 device->group_id = GetHMACForMediaDeviceID(
1047 request->salt, request->security_origin, device->group_id);
Guido Urdaneta 2016/08/29 13:59:47 according to the spec, this ID should be session-u
Max Morin 2016/08/29 14:14:33 Acknowledged.
1043 } 1048 }
1044 } 1049 }
1045 1050
1046 void MediaStreamManager::ClearEnumerationCache(EnumerationCache* cache) { 1051 void MediaStreamManager::ClearEnumerationCache(EnumerationCache* cache) {
1047 DCHECK(CalledOnIOThread()); 1052 DCHECK(CalledOnIOThread());
1048 cache->valid = false; 1053 cache->valid = false;
1049 } 1054 }
1050 1055
1051 bool MediaStreamManager::EnumerationRequired(EnumerationCache* cache, 1056 bool MediaStreamManager::EnumerationRequired(EnumerationCache* cache,
1052 MediaStreamType stream_type) { 1057 MediaStreamType stream_type) {
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 if (device_info.session_id == session_id && 2186 if (device_info.session_id == session_id &&
2182 device_info.device.type == type) { 2187 device_info.device.type == type) {
2183 request->SetCapturingLinkSecured(is_secure); 2188 request->SetCapturingLinkSecured(is_secure);
2184 return; 2189 return;
2185 } 2190 }
2186 } 2191 }
2187 } 2192 }
2188 } 2193 }
2189 2194
2190 } // namespace content 2195 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698