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/browser/renderer_host/media/web_contents_capture_util.h" |
9 #include "content/common/media/media_stream_messages.h" | 9 #include "content/common/media/media_stream_messages.h" |
10 #include "content/common/media/media_stream_options.h" | 10 #include "content/common/media/media_stream_options.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 << render_view_id << ", " | 140 << render_view_id << ", " |
141 << page_request_id << ", [" | 141 << page_request_id << ", [" |
142 << " audio:" << components.audio_type | 142 << " audio:" << components.audio_type |
143 << " video:" << components.video_type | 143 << " video:" << components.video_type |
144 << " ], " | 144 << " ], " |
145 << security_origin.spec() << ")"; | 145 << security_origin.spec() << ")"; |
146 | 146 |
147 const std::string& label = media_stream_manager_->GenerateStream( | 147 const std::string& label = media_stream_manager_->GenerateStream( |
148 this, render_process_id_, render_view_id, page_request_id, | 148 this, render_process_id_, render_view_id, page_request_id, |
149 components, security_origin); | 149 components, security_origin); |
150 if (label.empty()) { | 150 CHECK(!label.empty()); |
151 Send(new MediaStreamMsg_StreamGenerationFailed(render_view_id, | 151 StoreRequest(render_view_id, page_request_id, label); |
152 page_request_id)); | |
153 } else { | |
154 StoreRequest(render_view_id, page_request_id, label); | |
155 } | |
156 } | 152 } |
157 | 153 |
158 void MediaStreamDispatcherHost::OnCancelGenerateStream(int render_view_id, | 154 void MediaStreamDispatcherHost::OnCancelGenerateStream(int render_view_id, |
159 int page_request_id) { | 155 int page_request_id) { |
160 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelGenerateStream(" | 156 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelGenerateStream(" |
161 << render_view_id << ", " | 157 << render_view_id << ", " |
162 << page_request_id << ")"; | 158 << page_request_id << ")"; |
163 | 159 |
164 for (StreamMap::iterator it = streams_.begin(); it != streams_.end(); ++it) { | 160 for (StreamMap::iterator it = streams_.begin(); it != streams_.end(); ++it) { |
165 if (it->second.render_view_id == render_view_id && | 161 if (it->second.render_view_id == render_view_id && |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 MediaStreamDispatcherHost::StreamRequest | 254 MediaStreamDispatcherHost::StreamRequest |
259 MediaStreamDispatcherHost::PopRequest(const std::string& label) { | 255 MediaStreamDispatcherHost::PopRequest(const std::string& label) { |
260 StreamMap::iterator it = streams_.find(label); | 256 StreamMap::iterator it = streams_.find(label); |
261 CHECK(it != streams_.end()); | 257 CHECK(it != streams_.end()); |
262 StreamRequest request = it->second; | 258 StreamRequest request = it->second; |
263 streams_.erase(it); | 259 streams_.erase(it); |
264 return request; | 260 return request; |
265 } | 261 } |
266 | 262 |
267 } // namespace content | 263 } // namespace content |
OLD | NEW |