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

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

Issue 2365223002: Video Capture: Allow suspension of individual devices. (Closed)
Patch Set: 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 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 static MediaStreamVideoSource* GetVideoSource( 64 static MediaStreamVideoSource* GetVideoSource(
65 const blink::WebMediaStreamSource& source); 65 const blink::WebMediaStreamSource& source);
66 66
67 // Puts |track| in the registered tracks list. 67 // Puts |track| in the registered tracks list.
68 void AddTrack(MediaStreamVideoTrack* track, 68 void AddTrack(MediaStreamVideoTrack* track,
69 const VideoCaptureDeliverFrameCB& frame_callback, 69 const VideoCaptureDeliverFrameCB& frame_callback,
70 const blink::WebMediaConstraints& constraints, 70 const blink::WebMediaConstraints& constraints,
71 const ConstraintsCallback& callback); 71 const ConstraintsCallback& callback);
72 void RemoveTrack(MediaStreamVideoTrack* track); 72 void RemoveTrack(MediaStreamVideoTrack* track);
73 73
74 // Called by |track| to notify the source whether it has any paths to a
75 // consuming endpoint.
76 void UpdateHasConsumers(MediaStreamVideoTrack* track, bool has_consumers);
chfremer 2016/09/27 00:54:59 As a reader unfamiliar with this class, I am confu
miu 2016/09/27 23:42:23 Done. Made the SetXXX() methods protected, renamed
77
74 void UpdateCapturingLinkSecure(MediaStreamVideoTrack* track, bool is_secure); 78 void UpdateCapturingLinkSecure(MediaStreamVideoTrack* track, bool is_secure);
75 79
76 // Request underlying source to capture a new frame. 80 // Request underlying source to capture a new frame.
77 virtual void RequestRefreshFrame() {} 81 virtual void RequestRefreshFrame() {}
78 82
83 // Notify the underlying source whether there are one or more consumers
84 // present. When none are present, the source can stop delivering frames,
85 // giving it the option of running in an "idle" state to minimize resource
86 // usage.
87 virtual void SetHasConsumers(bool has_consumers) {}
88
79 // Notify underlying source if the capturing link is secure. 89 // Notify underlying source if the capturing link is secure.
80 virtual void SetCapturingLinkSecured(bool is_secure) {} 90 virtual void SetCapturingLinkSecured(bool is_secure) {}
81 91
82 // Returns the task runner where video frames will be delivered on. 92 // Returns the task runner where video frames will be delivered on.
83 base::SingleThreadTaskRunner* io_task_runner() const; 93 base::SingleThreadTaskRunner* io_task_runner() const;
84 94
85 const media::VideoCaptureFormat* GetCurrentFormat() const; 95 const media::VideoCaptureFormat* GetCurrentFormat() const;
86 96
87 base::WeakPtr<MediaStreamVideoSource> GetWeakPtr() { 97 base::WeakPtr<MediaStreamVideoSource> GetWeakPtr() {
88 return weak_factory_.GetWeakPtr(); 98 return weak_factory_.GetWeakPtr();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 std::vector<TrackDescriptor> track_descriptors_; 186 std::vector<TrackDescriptor> track_descriptors_;
177 187
178 media::VideoCaptureFormats supported_formats_; 188 media::VideoCaptureFormats supported_formats_;
179 189
180 // |track_adapter_| delivers video frames to the tracks on the IO-thread. 190 // |track_adapter_| delivers video frames to the tracks on the IO-thread.
181 const scoped_refptr<VideoTrackAdapter> track_adapter_; 191 const scoped_refptr<VideoTrackAdapter> track_adapter_;
182 192
183 // Tracks that currently are connected to this source. 193 // Tracks that currently are connected to this source.
184 std::vector<MediaStreamVideoTrack*> tracks_; 194 std::vector<MediaStreamVideoTrack*> tracks_;
185 195
196 // Tracks that have no paths to a consuming endpoint, and so do not need
197 // frames delivered from the source.
198 std::vector<MediaStreamVideoTrack*> suspended_tracks_;
199
186 // This is used for tracking if all connected video sinks are secure. 200 // This is used for tracking if all connected video sinks are secure.
187 SecureDisplayLinkTracker<MediaStreamVideoTrack> secure_tracker_; 201 SecureDisplayLinkTracker<MediaStreamVideoTrack> secure_tracker_;
188 202
189 // NOTE: Weak pointers must be invalidated before all other member variables. 203 // NOTE: Weak pointers must be invalidated before all other member variables.
190 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; 204 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_;
191 205
192 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); 206 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource);
193 }; 207 };
194 208
195 } // namespace content 209 } // namespace content
196 210
197 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ 211 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698