OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/renderer/media/capturefromelement/canvas_capture_handler.h" | 5 #include "content/renderer/media/capturefromelement/canvas_capture_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 std::unique_ptr<media::VideoCapturerSource> source, | 260 std::unique_ptr<media::VideoCapturerSource> source, |
261 blink::WebMediaStreamTrack* web_track) { | 261 blink::WebMediaStreamTrack* web_track) { |
262 std::string str_track_id; | 262 std::string str_track_id; |
263 base::Base64Encode(base::RandBytesAsString(64), &str_track_id); | 263 base::Base64Encode(base::RandBytesAsString(64), &str_track_id); |
264 const blink::WebString track_id = blink::WebString::fromASCII(str_track_id); | 264 const blink::WebString track_id = blink::WebString::fromASCII(str_track_id); |
265 blink::WebMediaStreamSource webkit_source; | 265 blink::WebMediaStreamSource webkit_source; |
266 std::unique_ptr<MediaStreamVideoSource> media_stream_source( | 266 std::unique_ptr<MediaStreamVideoSource> media_stream_source( |
267 new MediaStreamVideoCapturerSource( | 267 new MediaStreamVideoCapturerSource( |
268 MediaStreamSource::SourceStoppedCallback(), std::move(source))); | 268 MediaStreamSource::SourceStoppedCallback(), std::move(source))); |
269 webkit_source.initialize(track_id, blink::WebMediaStreamSource::TypeVideo, | 269 webkit_source.initialize(track_id, blink::WebMediaStreamSource::TypeVideo, |
270 track_id, false); | 270 track_id); |
271 webkit_source.setExtraData(media_stream_source.get()); | 271 webkit_source.setExtraData(media_stream_source.get()); |
272 | 272 |
273 web_track->initialize(webkit_source); | 273 web_track->initialize(webkit_source); |
274 blink::WebMediaConstraints constraints; | 274 blink::WebMediaConstraints constraints; |
275 constraints.initialize(); | 275 constraints.initialize(); |
276 web_track->setTrackData(new MediaStreamVideoTrack( | 276 web_track->setTrackData(new MediaStreamVideoTrack( |
277 media_stream_source.release(), constraints, | 277 media_stream_source.release(), constraints, |
278 MediaStreamVideoSource::ConstraintsCallback(), true)); | 278 MediaStreamVideoSource::ConstraintsCallback(), true)); |
279 } | 279 } |
280 | 280 |
281 } // namespace content | 281 } // namespace content |
OLD | NEW |