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

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

Issue 1124263004: New resolution change policies for desktop and tab capture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Inlined operator==(). Created 5 years, 7 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 static bool IsConstraintSupported(const std::string& name); 63 static bool IsConstraintSupported(const std::string& name);
64 64
65 // Returns the MessageLoopProxy where video frames will be delivered on. 65 // Returns the MessageLoopProxy where video frames will be delivered on.
66 const scoped_refptr<base::MessageLoopProxy>& io_message_loop() const; 66 const scoped_refptr<base::MessageLoopProxy>& io_message_loop() const;
67 67
68 // Constraint keys used by a video source. 68 // Constraint keys used by a video source.
69 // Specified by draft-alvestrand-constraints-resolution-00b 69 // Specified by draft-alvestrand-constraints-resolution-00b
70 static const char kMinAspectRatio[]; // minAspectRatio 70 static const char kMinAspectRatio[]; // minAspectRatio
71 static const char kMaxAspectRatio[]; // maxAspectRatio 71 static const char kMaxAspectRatio[]; // maxAspectRatio
72 static const char kMaxWidth[]; // maxWidth 72 static const char kMaxWidth[]; // maxWidth
73 static const char kMinWidth[]; // minWidthOnCaptureFormats 73 static const char kMinWidth[]; // minWidth
74 static const char kMaxHeight[]; // maxHeight 74 static const char kMaxHeight[]; // maxHeight
75 static const char kMinHeight[]; // minHeight 75 static const char kMinHeight[]; // minHeight
76 static const char kMaxFrameRate[]; // maxFrameRate 76 static const char kMaxFrameRate[]; // maxFrameRate
77 static const char kMinFrameRate[]; // minFrameRate 77 static const char kMinFrameRate[]; // minFrameRate
78 78
79 enum { 79 enum {
80 // Default resolution. If no constraints are specified and the delegate 80 // Default resolution. If no constraints are specified and the delegate
81 // support it, this is the resolution that will be used. 81 // support it, this is the resolution that will be used.
82 kDefaultWidth = 640, 82 kDefaultWidth = 640,
83 kDefaultHeight = 480, 83 kDefaultHeight = 480,
(...skipping 16 matching lines...) Expand all
100 // |max_requested_height| and |max_requested_width| is the max height and 100 // |max_requested_height| and |max_requested_width| is the max height and
101 // width set as a mandatory constraint if set when calling 101 // width set as a mandatory constraint if set when calling
102 // MediaStreamVideoSource::AddTrack. If max height and max width is not set 102 // MediaStreamVideoSource::AddTrack. If max height and max width is not set
103 // |max_requested_height| and |max_requested_width| are 0. 103 // |max_requested_height| and |max_requested_width| are 0.
104 virtual void GetCurrentSupportedFormats( 104 virtual void GetCurrentSupportedFormats(
105 int max_requested_width, 105 int max_requested_width,
106 int max_requested_height, 106 int max_requested_height,
107 double max_requested_frame_rate, 107 double max_requested_frame_rate,
108 const VideoCaptureDeviceFormatsCB& callback) = 0; 108 const VideoCaptureDeviceFormatsCB& callback) = 0;
109 109
110 // An implementation must start capture frames using the resolution in 110 // An implementation must start to capture frames using the requested
mcasas 2015/05/07 22:10:00 s/start to capture/start capturing/? (Disclaimer:
111 // |params|. When the source has started or the source failed to start 111 // |format|. The fulfilled |constraints| are provided as additional context,
112 // OnStartDone must be called. An implementation must call 112 // and may be used to modify the behavior of the source. When the source has
113 // |frame_callback| on the IO thread with the captured frames. 113 // started or the source failed to start OnStartDone must be called. An
114 // implementation must call |frame_callback| on the IO thread with the
115 // captured frames.
114 virtual void StartSourceImpl( 116 virtual void StartSourceImpl(
115 const media::VideoCaptureFormat& format, 117 const media::VideoCaptureFormat& format,
118 const blink::WebMediaConstraints& constraints,
116 const VideoCaptureDeliverFrameCB& frame_callback) = 0; 119 const VideoCaptureDeliverFrameCB& frame_callback) = 0;
117 void OnStartDone(MediaStreamRequestResult result); 120 void OnStartDone(MediaStreamRequestResult result);
118 121
119 // An implementation must immediately stop capture video frames and must not 122 // An implementation must immediately stop capture video frames and must not
120 // call OnSupportedFormats after this method has been called. After this 123 // call OnSupportedFormats after this method has been called. After this
121 // method has been called, MediaStreamVideoSource may be deleted. 124 // method has been called, MediaStreamVideoSource may be deleted.
122 virtual void StopSourceImpl() = 0; 125 virtual void StopSourceImpl() = 0;
123 126
124 enum State { 127 enum State {
125 NEW, 128 NEW,
126 RETRIEVING_CAPABILITIES, 129 RETRIEVING_CAPABILITIES,
127 STARTING, 130 STARTING,
128 STARTED, 131 STARTED,
129 ENDED 132 ENDED
130 }; 133 };
131 State state() const { return state_; } 134 State state() const { return state_; }
132 135
133 private: 136 private:
134 void OnSupportedFormats(const media::VideoCaptureFormats& formats); 137 void OnSupportedFormats(const media::VideoCaptureFormats& formats);
135 138
136 // Finds the first constraints in |requested_constraints_| that can be 139 // Finds the first constraints in |requested_constraints_| that can be
137 // fulfilled. |best_format| is set to the video resolution that can be 140 // fulfilled. |best_format| is set to the video resolution that can be
138 // fulfilled. 141 // fulfilled.
mcasas 2015/05/07 22:10:00 ... and |fulfilled_contraints| is the actual resul
miu 2015/05/08 06:43:34 Fixed comment, and added details about the return
139 bool FindBestFormatWithConstraints( 142 bool FindBestFormatWithConstraints(
140 const media::VideoCaptureFormats& formats, 143 const media::VideoCaptureFormats& formats,
141 media::VideoCaptureFormat* best_format); 144 media::VideoCaptureFormat* best_format,
145 blink::WebMediaConstraints* fulfilled_constraints);
142 146
143 // Trigger all cached callbacks from AddTrack. AddTrack is successful 147 // Trigger all cached callbacks from AddTrack. AddTrack is successful
144 // if the capture delegate has started and the constraints provided in 148 // if the capture delegate has started and the constraints provided in
145 // AddTrack match the format that was used to start the device. 149 // AddTrack match the format that was used to start the device.
146 // Note that it must be ok to delete the MediaStreamVideoSource object 150 // Note that it must be ok to delete the MediaStreamVideoSource object
147 // in the context of the callback. If gUM fail, the implementation will 151 // in the context of the callback. If gUM fail, the implementation will
148 // simply drop the references to the blink source and track which will lead 152 // simply drop the references to the blink source and track which will lead
149 // to that this object is deleted. 153 // to that this object is deleted.
150 void FinalizeAddTrack(); 154 void FinalizeAddTrack();
151 155
(...skipping 25 matching lines...) Expand all
177 181
178 // NOTE: Weak pointers must be invalidated before all other member variables. 182 // NOTE: Weak pointers must be invalidated before all other member variables.
179 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; 183 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_;
180 184
181 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); 185 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource);
182 }; 186 };
183 187
184 } // namespace content 188 } // namespace content
185 189
186 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ 190 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698