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

Side by Side Diff: content/renderer/media_capture_from_element/canvas_capture_handler.cc

Issue 2790823002: Spec compliant video constraints for getUserMedia behind flag. (Closed)
Patch Set: rebase Created 3 years, 8 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 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_capture_from_element/canvas_capture_handler.h" 5 #include "content/renderer/media_capture_from_element/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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 void CanvasCaptureHandler::StartVideoCapture( 166 void CanvasCaptureHandler::StartVideoCapture(
167 const media::VideoCaptureParams& params, 167 const media::VideoCaptureParams& params,
168 const media::VideoCapturerSource::VideoCaptureDeliverFrameCB& 168 const media::VideoCapturerSource::VideoCaptureDeliverFrameCB&
169 new_frame_callback, 169 new_frame_callback,
170 const media::VideoCapturerSource::RunningCallback& running_callback) { 170 const media::VideoCapturerSource::RunningCallback& running_callback) {
171 DVLOG(3) << __func__ << " requested " 171 DVLOG(3) << __func__ << " requested "
172 << media::VideoCaptureFormat::ToString(params.requested_format); 172 << media::VideoCaptureFormat::ToString(params.requested_format);
173 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 173 DCHECK(main_render_thread_checker_.CalledOnValidThread());
174 DCHECK(params.requested_format.IsValid()); 174 DCHECK(params.requested_format.IsValid());
175
176 // TODO(emircan): Accomodate to the given frame rate constraints here.
177 capture_format_ = params.requested_format; 175 capture_format_ = params.requested_format;
178 delegate_.reset(new CanvasCaptureHandlerDelegate(new_frame_callback)); 176 delegate_.reset(new CanvasCaptureHandlerDelegate(new_frame_callback));
179 DCHECK(delegate_); 177 DCHECK(delegate_);
180 ask_for_new_frame_ = true; 178 ask_for_new_frame_ = true;
181 running_callback.Run(true); 179 running_callback.Run(true);
182 } 180 }
183 181
184 void CanvasCaptureHandler::RequestRefreshFrame() { 182 void CanvasCaptureHandler::RequestRefreshFrame() {
185 DVLOG(3) << __func__; 183 DVLOG(3) << __func__;
186 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 184 DCHECK(main_render_thread_checker_.CalledOnValidThread());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 const blink::WebString track_id = blink::WebString::fromASCII(str_track_id); 258 const blink::WebString track_id = blink::WebString::fromASCII(str_track_id);
261 blink::WebMediaStreamSource webkit_source; 259 blink::WebMediaStreamSource webkit_source;
262 std::unique_ptr<MediaStreamVideoSource> media_stream_source( 260 std::unique_ptr<MediaStreamVideoSource> media_stream_source(
263 new MediaStreamVideoCapturerSource( 261 new MediaStreamVideoCapturerSource(
264 MediaStreamSource::SourceStoppedCallback(), std::move(source))); 262 MediaStreamSource::SourceStoppedCallback(), std::move(source)));
265 webkit_source.initialize(track_id, blink::WebMediaStreamSource::TypeVideo, 263 webkit_source.initialize(track_id, blink::WebMediaStreamSource::TypeVideo,
266 track_id, false); 264 track_id, false);
267 webkit_source.setExtraData(media_stream_source.get()); 265 webkit_source.setExtraData(media_stream_source.get());
268 266
269 web_track->initialize(webkit_source); 267 web_track->initialize(webkit_source);
270 blink::WebMediaConstraints constraints;
271 constraints.initialize();
272 web_track->setTrackData(new MediaStreamVideoTrack( 268 web_track->setTrackData(new MediaStreamVideoTrack(
273 media_stream_source.release(), constraints, 269 media_stream_source.release(),
274 MediaStreamVideoSource::ConstraintsCallback(), true)); 270 MediaStreamVideoSource::ConstraintsCallback(), true));
275 } 271 }
276 272
277 } // namespace content 273 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698