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

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

Issue 2365223002: Video Capture: Allow suspension of individual devices. (Closed)
Patch Set: Style tweaks, per mcasas's comments. Created 4 years, 2 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 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 386 }
387 387
388 // Call |frame_adapter_->RemoveTrack| here even if adding the track has 388 // Call |frame_adapter_->RemoveTrack| here even if adding the track has
389 // failed and |frame_adapter_->AddCallback| has not been called. 389 // failed and |frame_adapter_->AddCallback| has not been called.
390 track_adapter_->RemoveTrack(video_track); 390 track_adapter_->RemoveTrack(video_track);
391 391
392 if (tracks_.empty()) 392 if (tracks_.empty())
393 StopSource(); 393 StopSource();
394 } 394 }
395 395
396 void MediaStreamVideoSource::UpdateHasConsumers(MediaStreamVideoTrack* track,
397 bool has_consumers) {
398 DCHECK(CalledOnValidThread());
399 const auto it =
400 std::find(suspended_tracks_.begin(), suspended_tracks_.end(), track);
401 if (has_consumers) {
402 if (it != suspended_tracks_.end())
403 suspended_tracks_.erase(it);
404 } else {
405 if (it == suspended_tracks_.end())
406 suspended_tracks_.push_back(track);
407 }
408 OnHasConsumers(suspended_tracks_.size() < tracks_.size());
409 }
410
396 void MediaStreamVideoSource::UpdateCapturingLinkSecure( 411 void MediaStreamVideoSource::UpdateCapturingLinkSecure(
397 MediaStreamVideoTrack* track, 412 MediaStreamVideoTrack* track, bool is_secure) {
398 bool is_secure) { 413 DCHECK(CalledOnValidThread());
399 secure_tracker_.Update(track, is_secure); 414 secure_tracker_.Update(track, is_secure);
400 SetCapturingLinkSecured(secure_tracker_.is_capturing_secure()); 415 OnCapturingLinkSecured(secure_tracker_.is_capturing_secure());
401 } 416 }
402 417
403 base::SingleThreadTaskRunner* MediaStreamVideoSource::io_task_runner() const { 418 base::SingleThreadTaskRunner* MediaStreamVideoSource::io_task_runner() const {
404 DCHECK(CalledOnValidThread()); 419 DCHECK(CalledOnValidThread());
405 return track_adapter_->io_task_runner(); 420 return track_adapter_->io_task_runner();
406 } 421 }
407 422
408 const media::VideoCaptureFormat* 423 const media::VideoCaptureFormat*
409 MediaStreamVideoSource::GetCurrentFormat() const { 424 MediaStreamVideoSource::GetCurrentFormat() const {
410 DCHECK(CalledOnValidThread()); 425 DCHECK(CalledOnValidThread());
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 callback(callback) { 605 callback(callback) {
591 } 606 }
592 607
593 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( 608 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor(
594 const TrackDescriptor& other) = default; 609 const TrackDescriptor& other) = default;
595 610
596 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { 611 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() {
597 } 612 }
598 613
599 } // namespace content 614 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_video_source.h ('k') | content/renderer/media/media_stream_video_track.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698