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

Unified Diff: content/renderer/media/media_stream_video_source.h

Issue 2365223002: Video Capture: Allow suspension of individual devices. (Closed)
Patch Set: Style tweaks, per mcasas's comments. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_video_source.h
diff --git a/content/renderer/media/media_stream_video_source.h b/content/renderer/media/media_stream_video_source.h
index 3d79aeafb776d0fe9c84c08615d4f688df848e34..ee11f63cc0b7655aee63f57a58a4cb2943af8a02 100644
--- a/content/renderer/media/media_stream_video_source.h
+++ b/content/renderer/media/media_stream_video_source.h
@@ -71,14 +71,15 @@ class CONTENT_EXPORT MediaStreamVideoSource
const ConstraintsCallback& callback);
void RemoveTrack(MediaStreamVideoTrack* track);
+ // Called by |track| to notify the source whether it has any paths to a
+ // consuming endpoint.
+ void UpdateHasConsumers(MediaStreamVideoTrack* track, bool has_consumers);
+
void UpdateCapturingLinkSecure(MediaStreamVideoTrack* track, bool is_secure);
// Request underlying source to capture a new frame.
virtual void RequestRefreshFrame() {}
- // Notify underlying source if the capturing link is secure.
- virtual void SetCapturingLinkSecured(bool is_secure) {}
-
// Returns the task runner where video frames will be delivered on.
base::SingleThreadTaskRunner* io_task_runner() const;
@@ -126,6 +127,16 @@ class CONTENT_EXPORT MediaStreamVideoSource
// method has been called, MediaStreamVideoSource may be deleted.
virtual void StopSourceImpl() = 0;
+ // Optionally overridden by subclasses to act on whether there are any
+ // consumers present. When none are present, the source can stop delivering
+ // frames, giving it the option of running in an "idle" state to minimize
+ // resource usage.
+ virtual void OnHasConsumers(bool has_consumers) {}
+
+ // Optionally overridden by subclasses to act on whether the capturing link
+ // has become secure or insecure.
+ virtual void OnCapturingLinkSecured(bool is_secure) {}
+
enum State {
NEW,
RETRIEVING_CAPABILITIES,
@@ -183,6 +194,10 @@ class CONTENT_EXPORT MediaStreamVideoSource
// Tracks that currently are connected to this source.
std::vector<MediaStreamVideoTrack*> tracks_;
+ // Tracks that have no paths to a consuming endpoint, and so do not need
+ // frames delivered from the source. This is a subset of |tracks_|.
+ std::vector<MediaStreamVideoTrack*> suspended_tracks_;
+
// This is used for tracking if all connected video sinks are secure.
SecureDisplayLinkTracker<MediaStreamVideoTrack> secure_tracker_;
« no previous file with comments | « content/renderer/media/media_stream_video_capturer_source.cc ('k') | content/renderer/media/media_stream_video_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698