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_dispatcher_host.h" | 5 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" |
6 | 6 |
7 #include "content/browser/browser_main_loop.h" | 7 #include "content/browser/browser_main_loop.h" |
8 #include "content/browser/renderer_host/media/web_contents_capture_util.h" | |
8 #include "content/common/media/media_stream_messages.h" | 9 #include "content/common/media/media_stream_messages.h" |
9 #include "content/common/media/media_stream_options.h" | 10 #include "content/common/media/media_stream_options.h" |
10 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 struct MediaStreamDispatcherHost::StreamRequest { | 15 struct MediaStreamDispatcherHost::StreamRequest { |
15 StreamRequest() : render_view_id(0), page_request_id(0) {} | 16 StreamRequest() : render_view_id(0), page_request_id(0) {} |
16 StreamRequest(int render_view_id, int page_request_id) | 17 StreamRequest(int render_view_id, int page_request_id) |
17 : render_view_id(render_view_id), | 18 : render_view_id(render_view_id), |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 << render_view_id << ", " | 135 << render_view_id << ", " |
135 << page_request_id << ", [" | 136 << page_request_id << ", [" |
136 << " audio:" << components.audio_type | 137 << " audio:" << components.audio_type |
137 << " video:" << components.video_type | 138 << " video:" << components.video_type |
138 << " ], " | 139 << " ], " |
139 << security_origin.spec() << ")"; | 140 << security_origin.spec() << ")"; |
140 | 141 |
141 std::string label; | 142 std::string label; |
142 if (components.audio_type == MEDIA_TAB_AUDIO_CAPTURE || | 143 if (components.audio_type == MEDIA_TAB_AUDIO_CAPTURE || |
143 components.video_type == MEDIA_TAB_VIDEO_CAPTURE) { | 144 components.video_type == MEDIA_TAB_VIDEO_CAPTURE) { |
144 const std::string& device_id = components.video_device_id; | 145 DCHECK(!components.video_device_id.empty()); |
145 DCHECK(!device_id.empty()); | 146 |
147 // Append our tab capture device id scheme. | |
148 // TODO(justinlin): This is kind of a hack, but the plumbing for audio | |
Alpha Left Google
2012/11/28 01:04:47
File a bug and put the link here.
justinlin
2012/11/28 14:30:31
Done.
| |
149 // streams is too complicated to plumb in by type. Will revisit once it's | |
150 // refactored. | |
151 const std::string& device_id = | |
152 WebContentsCaptureUtil::AppendWebContentsDeviceScheme( | |
153 components.video_device_id); | |
154 | |
146 // TODO(justinlin): Cleanup/get rid of GenerateStreamForDevice and merge | 155 // TODO(justinlin): Cleanup/get rid of GenerateStreamForDevice and merge |
147 // with the regular GenerateStream. | 156 // with the regular GenerateStream. |
148 GetManager()->GenerateStreamForDevice( | 157 GetManager()->GenerateStreamForDevice( |
149 this, render_process_id_, render_view_id, | 158 this, render_process_id_, render_view_id, |
150 components, device_id, security_origin, &label); | 159 components, device_id, security_origin, &label); |
151 } else { | 160 } else { |
152 GetManager()->GenerateStream(this, render_process_id_, render_view_id, | 161 GetManager()->GenerateStream(this, render_process_id_, render_view_id, |
153 components, security_origin, &label); | 162 components, security_origin, &label); |
154 } | 163 } |
155 DCHECK(!label.empty()); | 164 DCHECK(!label.empty()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 device_id, type, security_origin, &label); | 225 device_id, type, security_origin, &label); |
217 DCHECK(!label.empty()); | 226 DCHECK(!label.empty()); |
218 streams_[label] = StreamRequest(render_view_id, page_request_id); | 227 streams_[label] = StreamRequest(render_view_id, page_request_id); |
219 } | 228 } |
220 | 229 |
221 MediaStreamManager* MediaStreamDispatcherHost::GetManager() { | 230 MediaStreamManager* MediaStreamDispatcherHost::GetManager() { |
222 return BrowserMainLoop::GetMediaStreamManager(); | 231 return BrowserMainLoop::GetMediaStreamManager(); |
223 } | 232 } |
224 | 233 |
225 } // namespace content | 234 } // namespace content |
OLD | NEW |