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

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

Issue 2365223002: Video Capture: Allow suspension of individual devices. (Closed)
Patch Set: REBASE, and clean-ups+tests suggested by chfremer@. 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..fe2612a5359364c6a3a7f4f10b7b287ec8744b6f 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.
mcasas 2016/09/28 21:34:44 nit: I'd add that |suspended_tracks_| is a subset
miu 2016/09/28 22:35:15 Done.
+ std::vector<MediaStreamVideoTrack*> suspended_tracks_;
+
// This is used for tracking if all connected video sinks are secure.
SecureDisplayLinkTracker<MediaStreamVideoTrack> secure_tracker_;

Powered by Google App Engine
This is Rietveld 408576698