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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
102 if (controls.audio.requested) { | 105 if (controls.audio.requested) { |
103 if (!controls.audio.stream_source.empty()) { | 106 if (!controls.audio.stream_source.empty()) { |
104 // This is tab or screen capture. | 107 // This is tab or screen capture. |
105 if (controls.audio.stream_source == kMediaStreamSourceTab) { | 108 if (controls.audio.stream_source == kMediaStreamSourceTab) { |
106 *audio_type = content::MEDIA_TAB_AUDIO_CAPTURE; | 109 *audio_type = content::MEDIA_TAB_AUDIO_CAPTURE; |
107 } else if (controls.audio.stream_source == kMediaStreamSourceSystem) { | 110 } else if (controls.audio.stream_source == kMediaStreamSourceSystem) { |
108 *audio_type = content::MEDIA_DESKTOP_AUDIO_CAPTURE; | 111 *audio_type = content::MEDIA_DESKTOP_AUDIO_CAPTURE; |
| 112 } else if (audio_support_flag_for_desktop_share && |
| 113 controls.audio.stream_source == kMediaStreamSourceDesktop) { |
| 114 *audio_type = content::MEDIA_DESKTOP_AUDIO_CAPTURE; |
109 } | 115 } |
110 } else { | 116 } else { |
111 // This is normal audio device capture. | 117 // This is normal audio device capture. |
112 *audio_type = MEDIA_DEVICE_AUDIO_CAPTURE; | 118 *audio_type = MEDIA_DEVICE_AUDIO_CAPTURE; |
113 } | 119 } |
114 } | 120 } |
115 if (controls.video.requested) { | 121 if (controls.video.requested) { |
116 if (!controls.video.stream_source.empty()) { | 122 if (!controls.video.stream_source.empty()) { |
117 // This is tab or screen capture. | 123 // This is tab or screen capture. |
118 if (controls.video.stream_source == kMediaStreamSourceTab) { | 124 if (controls.video.stream_source == kMediaStreamSourceTab) { |
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2073 const std::string& device_guid, | 2079 const std::string& device_guid, |
2074 const std::string& raw_unique_id) { | 2080 const std::string& raw_unique_id) { |
2075 DCHECK(security_origin.is_valid()); | 2081 DCHECK(security_origin.is_valid()); |
2076 DCHECK(!raw_unique_id.empty()); | 2082 DCHECK(!raw_unique_id.empty()); |
2077 std::string guid_from_raw_device_id = | 2083 std::string guid_from_raw_device_id = |
2078 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); | 2084 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); |
2079 return guid_from_raw_device_id == device_guid; | 2085 return guid_from_raw_device_id == device_guid; |
2080 } | 2086 } |
2081 | 2087 |
2082 } // namespace content | 2088 } // namespace content |
OLD | NEW |