OLD | NEW |
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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 bool MediaStreamVideoSource::IsConstraintSupported(const std::string& name) { | 344 bool MediaStreamVideoSource::IsConstraintSupported(const std::string& name) { |
345 for (const char* constraint : kSupportedConstraints) { | 345 for (const char* constraint : kSupportedConstraints) { |
346 if (constraint == name) | 346 if (constraint == name) |
347 return true; | 347 return true; |
348 } | 348 } |
349 return false; | 349 return false; |
350 } | 350 } |
351 | 351 |
352 MediaStreamVideoSource::MediaStreamVideoSource() | 352 MediaStreamVideoSource::MediaStreamVideoSource() |
353 : state_(NEW), | 353 : state_(NEW), |
354 track_adapter_(new VideoTrackAdapter( | 354 track_adapter_( |
355 ChildProcess::current()->io_message_loop_proxy())), | 355 new VideoTrackAdapter(ChildProcess::current()->io_task_runner())), |
356 weak_factory_(this) { | 356 weak_factory_(this) { |
357 } | 357 } |
358 | 358 |
359 MediaStreamVideoSource::~MediaStreamVideoSource() { | 359 MediaStreamVideoSource::~MediaStreamVideoSource() { |
360 DCHECK(CalledOnValidThread()); | 360 DCHECK(CalledOnValidThread()); |
361 } | 361 } |
362 | 362 |
363 void MediaStreamVideoSource::AddTrack( | 363 void MediaStreamVideoSource::AddTrack( |
364 MediaStreamVideoTrack* track, | 364 MediaStreamVideoTrack* track, |
365 const VideoCaptureDeliverFrameCB& frame_callback, | 365 const VideoCaptureDeliverFrameCB& frame_callback, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 } | 434 } |
435 } | 435 } |
436 // Call |frame_adapter_->RemoveTrack| here even if adding the track has | 436 // Call |frame_adapter_->RemoveTrack| here even if adding the track has |
437 // failed and |frame_adapter_->AddCallback| has not been called. | 437 // failed and |frame_adapter_->AddCallback| has not been called. |
438 track_adapter_->RemoveTrack(video_track); | 438 track_adapter_->RemoveTrack(video_track); |
439 | 439 |
440 if (tracks_.empty()) | 440 if (tracks_.empty()) |
441 StopSource(); | 441 StopSource(); |
442 } | 442 } |
443 | 443 |
444 const scoped_refptr<base::MessageLoopProxy>& | 444 base::SingleThreadTaskRunner* MediaStreamVideoSource::io_task_runner() const { |
445 MediaStreamVideoSource::io_message_loop() const { | |
446 DCHECK(CalledOnValidThread()); | 445 DCHECK(CalledOnValidThread()); |
447 return track_adapter_->io_message_loop(); | 446 return track_adapter_->io_task_runner(); |
448 } | 447 } |
449 | 448 |
450 void MediaStreamVideoSource::DoStopSource() { | 449 void MediaStreamVideoSource::DoStopSource() { |
451 DCHECK(CalledOnValidThread()); | 450 DCHECK(CalledOnValidThread()); |
452 DVLOG(3) << "DoStopSource()"; | 451 DVLOG(3) << "DoStopSource()"; |
453 if (state_ == ENDED) | 452 if (state_ == ENDED) |
454 return; | 453 return; |
455 track_adapter_->StopFrameMonitoring(); | 454 track_adapter_->StopFrameMonitoring(); |
456 StopSourceImpl(); | 455 StopSourceImpl(); |
457 state_ = ENDED; | 456 state_ = ENDED; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 : track(track), | 613 : track(track), |
615 frame_callback(frame_callback), | 614 frame_callback(frame_callback), |
616 constraints(constraints), | 615 constraints(constraints), |
617 callback(callback) { | 616 callback(callback) { |
618 } | 617 } |
619 | 618 |
620 MediaStreamVideoSource::RequestedConstraints::~RequestedConstraints() { | 619 MediaStreamVideoSource::RequestedConstraints::~RequestedConstraints() { |
621 } | 620 } |
622 | 621 |
623 } // namespace content | 622 } // namespace content |
OLD | NEW |