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

Side by Side Diff: content/renderer/media/media_stream_video_source.cc

Issue 201583003: Implement a source for remote video tracks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/media_stream_video_source.h" 5 #include "content/renderer/media/media_stream_video_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 MediaStreamVideoSource* MediaStreamVideoSource::GetVideoSource( 281 MediaStreamVideoSource* MediaStreamVideoSource::GetVideoSource(
282 const blink::WebMediaStreamSource& source) { 282 const blink::WebMediaStreamSource& source) {
283 return static_cast<MediaStreamVideoSource*>(source.extraData()); 283 return static_cast<MediaStreamVideoSource*>(source.extraData());
284 } 284 }
285 285
286 MediaStreamVideoSource::MediaStreamVideoSource( 286 MediaStreamVideoSource::MediaStreamVideoSource(
287 MediaStreamDependencyFactory* factory) 287 MediaStreamDependencyFactory* factory)
288 : state_(NEW), 288 : state_(NEW),
289 factory_(factory), 289 factory_(factory),
290 capture_adapter_(NULL) { 290 capture_adapter_(NULL) {
291 DCHECK(factory_);
292 } 291 }
293 292
294 MediaStreamVideoSource::~MediaStreamVideoSource() { 293 MediaStreamVideoSource::~MediaStreamVideoSource() {
295 } 294 }
296 295
297 void MediaStreamVideoSource::AddTrack( 296 void MediaStreamVideoSource::AddTrack(
298 MediaStreamVideoTrack* track, 297 MediaStreamVideoTrack* track,
299 const blink::WebMediaConstraints& constraints, 298 const blink::WebMediaConstraints& constraints,
300 const ConstraintsCallback& callback) { 299 const ConstraintsCallback& callback) {
301 DCHECK(CalledOnValidThread()); 300 DCHECK(CalledOnValidThread());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 void MediaStreamVideoSource::InitAdapter() { 345 void MediaStreamVideoSource::InitAdapter() {
347 if (adapter_) 346 if (adapter_)
348 return; 347 return;
349 // Create the webrtc::MediaStreamVideoSourceInterface adapter. 348 // Create the webrtc::MediaStreamVideoSourceInterface adapter.
350 // It needs the constraints so that constraints used by a PeerConnection 349 // It needs the constraints so that constraints used by a PeerConnection
351 // will be available such as constraints for CPU adaptation and a tab 350 // will be available such as constraints for CPU adaptation and a tab
352 // capture. 351 // capture.
353 bool is_screeencast = 352 bool is_screeencast =
354 device_info().device.type == MEDIA_TAB_VIDEO_CAPTURE || 353 device_info().device.type == MEDIA_TAB_VIDEO_CAPTURE ||
355 device_info().device.type == MEDIA_DESKTOP_VIDEO_CAPTURE; 354 device_info().device.type == MEDIA_DESKTOP_VIDEO_CAPTURE;
356 capture_adapter_ = factory_->CreateVideoCapturer(is_screeencast); 355 capture_adapter_ = factory_->CreateVideoCapturer(is_screeencast);
Ronghua Wu (Left Chromium) 2014/03/17 22:45:35 since we no longer assert factory_, we should chec
perkj_chrome 2014/03/19 16:34:48 Other reviewers typically say that is no need. Sin
Ronghua Wu (Left Chromium) 2014/03/20 21:55:50 ok. :)
357 capture_adapter_->SetRequestedFormat(current_format_); 356 capture_adapter_->SetRequestedFormat(current_format_);
358 adapter_ = factory_->CreateVideoSource(capture_adapter_, 357 adapter_ = factory_->CreateVideoSource(capture_adapter_,
359 current_constraints_); 358 current_constraints_);
360 } 359 }
361 360
362 webrtc::VideoSourceInterface* MediaStreamVideoSource::GetAdapter() { 361 webrtc::VideoSourceInterface* MediaStreamVideoSource::GetAdapter() {
363 if (!adapter_) { 362 if (!adapter_) {
364 InitAdapter(); 363 InitAdapter();
365 } 364 }
366 return adapter_; 365 return adapter_;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 MediaStreamVideoSource::RequestedConstraints::RequestedConstraints( 516 MediaStreamVideoSource::RequestedConstraints::RequestedConstraints(
518 const blink::WebMediaConstraints& constraints, 517 const blink::WebMediaConstraints& constraints,
519 const ConstraintsCallback& callback) 518 const ConstraintsCallback& callback)
520 : constraints(constraints), callback(callback) { 519 : constraints(constraints), callback(callback) {
521 } 520 }
522 521
523 MediaStreamVideoSource::RequestedConstraints::~RequestedConstraints() { 522 MediaStreamVideoSource::RequestedConstraints::~RequestedConstraints() {
524 } 523 }
525 524
526 } // namespace content 525 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698