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

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

Issue 1576073003: Support Audio for Desktop Capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style Fix 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
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 DCHECK(std::isalnum(c)) << c; 92 DCHECK(std::isalnum(c)) << c;
93 } 93 }
94 return label; 94 return label;
95 } 95 }
96 96
97 void ParseStreamType(const StreamControls& controls, 97 void ParseStreamType(const StreamControls& controls,
98 MediaStreamType* audio_type, 98 MediaStreamType* audio_type,
99 MediaStreamType* video_type) { 99 MediaStreamType* video_type) {
100 *audio_type = MEDIA_NO_SERVICE; 100 *audio_type = MEDIA_NO_SERVICE;
101 *video_type = MEDIA_NO_SERVICE; 101 *video_type = MEDIA_NO_SERVICE;
102 const bool audio_support_flag_for_desktop_share =
103 base::CommandLine::ForCurrentProcess()->HasSwitch(
104 switches::kEnableAudioSupportForDesktopShare);
105
102 if (controls.audio.requested) { 106 if (controls.audio.requested) {
103 if (!controls.audio.stream_source.empty()) { 107 if (!controls.audio.stream_source.empty()) {
104 // This is tab or screen capture. 108 // This is tab or screen capture.
105 if (controls.audio.stream_source == kMediaStreamSourceTab) { 109 if (controls.audio.stream_source == kMediaStreamSourceTab) {
106 *audio_type = content::MEDIA_TAB_AUDIO_CAPTURE; 110 *audio_type = content::MEDIA_TAB_AUDIO_CAPTURE;
107 } else if (controls.audio.stream_source == kMediaStreamSourceSystem) { 111 } else if (controls.audio.stream_source == kMediaStreamSourceSystem) {
108 *audio_type = content::MEDIA_DESKTOP_AUDIO_CAPTURE; 112 *audio_type = content::MEDIA_DESKTOP_AUDIO_CAPTURE;
113 } else if (audio_support_flag_for_desktop_share &&
114 controls.audio.stream_source == kMediaStreamSourceDesktop) {
115 *audio_type = content::MEDIA_DESKTOP_AUDIO_CAPTURE;
109 } 116 }
110 } else { 117 } else {
111 // This is normal audio device capture. 118 // This is normal audio device capture.
112 *audio_type = MEDIA_DEVICE_AUDIO_CAPTURE; 119 *audio_type = MEDIA_DEVICE_AUDIO_CAPTURE;
113 } 120 }
114 } 121 }
115 if (controls.video.requested) { 122 if (controls.video.requested) {
116 if (!controls.video.stream_source.empty()) { 123 if (!controls.video.stream_source.empty()) {
117 // This is tab or screen capture. 124 // This is tab or screen capture.
118 if (controls.video.stream_source == kMediaStreamSourceTab) { 125 if (controls.video.stream_source == kMediaStreamSourceTab) {
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 const std::string& device_guid, 2080 const std::string& device_guid,
2074 const std::string& raw_unique_id) { 2081 const std::string& raw_unique_id) {
2075 DCHECK(security_origin.is_valid()); 2082 DCHECK(security_origin.is_valid());
2076 DCHECK(!raw_unique_id.empty()); 2083 DCHECK(!raw_unique_id.empty());
2077 std::string guid_from_raw_device_id = 2084 std::string guid_from_raw_device_id =
2078 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); 2085 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id);
2079 return guid_from_raw_device_id == device_guid; 2086 return guid_from_raw_device_id == device_guid;
2080 } 2087 }
2081 2088
2082 } // namespace content 2089 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698