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

Side by Side Diff: webrtc/media/base/videocapturer.h

Issue 1832793002: More cleanup of cricket::VideoCapturer Remove unused state CS_PAUSED Remove unused SignalVideoFrame (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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 /* 1 /*
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 namespace cricket { 32 namespace cricket {
33 33
34 // Current state of the capturer. 34 // Current state of the capturer.
35 enum CaptureState { 35 enum CaptureState {
36 CS_STOPPED, // The capturer has been stopped or hasn't started yet. 36 CS_STOPPED, // The capturer has been stopped or hasn't started yet.
37 CS_STARTING, // The capturer is in the process of starting. Note, it may 37 CS_STARTING, // The capturer is in the process of starting. Note, it may
38 // still fail to start. 38 // still fail to start.
39 CS_RUNNING, // The capturer has been started successfully and is now 39 CS_RUNNING, // The capturer has been started successfully and is now
40 // capturing. 40 // capturing.
41 CS_PAUSED, // The capturer has been paused.
42 CS_FAILED, // The capturer failed to start. 41 CS_FAILED, // The capturer failed to start.
43 }; 42 };
44 43
45 class VideoFrame; 44 class VideoFrame;
46 45
47 struct CapturedFrame { 46 struct CapturedFrame {
48 static const uint32_t kFrameHeaderSize = 40; // Size from width to data_size. 47 static const uint32_t kFrameHeaderSize = 40; // Size from width to data_size.
49 static const uint32_t kUnknownDataSize = 0xFFFFFFFF; 48 static const uint32_t kUnknownDataSize = 0xFFFFFFFF;
50 49
51 CapturedFrame(); 50 CapturedFrame();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 bool StartCapturing(const VideoFormat& capture_format); 140 bool StartCapturing(const VideoFormat& capture_format);
142 // Start the video capturer with the specified capture format. 141 // Start the video capturer with the specified capture format.
143 // Parameter 142 // Parameter
144 // capture_format: The caller got this parameter by either calling 143 // capture_format: The caller got this parameter by either calling
145 // GetSupportedFormats() and selecting one of the supported 144 // GetSupportedFormats() and selecting one of the supported
146 // or calling GetBestCaptureFormat(). 145 // or calling GetBestCaptureFormat().
147 // Return 146 // Return
148 // CS_STARTING: The capturer is trying to start. Success or failure will 147 // CS_STARTING: The capturer is trying to start. Success or failure will
149 // be notified via the |SignalStateChange| callback. 148 // be notified via the |SignalStateChange| callback.
150 // CS_RUNNING: if the capturer is started and capturing. 149 // CS_RUNNING: if the capturer is started and capturing.
151 // CS_PAUSED: Will never be returned.
152 // CS_FAILED: if the capturer failes to start.. 150 // CS_FAILED: if the capturer failes to start..
153 // CS_NO_DEVICE: if the capturer has no device and fails to start. 151 // CS_NO_DEVICE: if the capturer has no device and fails to start.
154 virtual CaptureState Start(const VideoFormat& capture_format) = 0; 152 virtual CaptureState Start(const VideoFormat& capture_format) = 0;
155 153
156 // Get the current capture format, which is set by the Start() call. 154 // Get the current capture format, which is set by the Start() call.
157 // Note that the width and height of the captured frames may differ from the 155 // Note that the width and height of the captured frames may differ from the
158 // capture format. For example, the capture format is HD but the captured 156 // capture format. For example, the capture format is HD but the captured
159 // frames may be smaller than HD. 157 // frames may be smaller than HD.
160 const VideoFormat* GetCaptureFormat() const { 158 const VideoFormat* GetCaptureFormat() const {
161 return capture_format_.get(); 159 return capture_format_.get();
162 } 160 }
163 161
164 // Pause the video capturer.
165 // DEPRECATED
166 // TODO(perkj): Remove once Chrome remoting doesn't override this method.
167 virtual bool Pause(bool paused) {
168 RTC_NOTREACHED();
169 return false;
170 }
171 // Stop the video capturer. 162 // Stop the video capturer.
172 virtual void Stop() = 0; 163 virtual void Stop() = 0;
173 // Check if the video capturer is running. 164 // Check if the video capturer is running.
174 virtual bool IsRunning() = 0; 165 virtual bool IsRunning() = 0;
175 CaptureState capture_state() const { 166 CaptureState capture_state() const {
176 return capture_state_; 167 return capture_state_;
177 } 168 }
178 169
179 virtual bool GetApplyRotation() { return apply_rotation_; } 170 virtual bool GetApplyRotation() { return apply_rotation_; }
180 171
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // TODO(nisse): Rename function? Or pass the frame format before 212 // TODO(nisse): Rename function? Or pass the frame format before
222 // adaptation in some other way. 213 // adaptation in some other way.
223 void GetStats(VideoFormat* last_captured_frame_format); 214 void GetStats(VideoFormat* last_captured_frame_format);
224 215
225 // Implements VideoSourceInterface 216 // Implements VideoSourceInterface
226 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, 217 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink,
227 const rtc::VideoSinkWants& wants) override; 218 const rtc::VideoSinkWants& wants) override;
228 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; 219 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override;
229 220
230 protected: 221 protected:
231 // Signal the captured and possibly adapted frame to downstream consumers
232 // such as the encoder.
233 // TODO(perkj): Remove once it is not used by remoting in Chrome.
234 sigslot::signal2<VideoCapturer*, const VideoFrame*,
235 sigslot::multi_threaded_local> SignalVideoFrame;
236
237 // OnSinkWantsChanged can be overridden to change the default behavior 222 // OnSinkWantsChanged can be overridden to change the default behavior
238 // when a sink changes its VideoSinkWants by calling AddOrUpdateSink. 223 // when a sink changes its VideoSinkWants by calling AddOrUpdateSink.
239 virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); 224 virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants);
240 225
241 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called. 226 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called.
242 void OnFrameCaptured(VideoCapturer* video_capturer, 227 void OnFrameCaptured(VideoCapturer* video_capturer,
243 const CapturedFrame* captured_frame); 228 const CapturedFrame* captured_frame);
244 229
245 // Callback attached to SignalVideoFrame. 230 // Called when a frame has been captured and converted to a VideoFrame.
246 // TODO(perkj): Remove once SignalVideoFrame is removed. 231 // OnFrame can be called directly by an implementation that does not use
232 // SignalFrameCaptured or OnFrameCaptured.
247 void OnFrame(VideoCapturer* capturer, const VideoFrame* frame); 233 void OnFrame(VideoCapturer* capturer, const VideoFrame* frame);
248 234
249 CoordinatedVideoAdapter* video_adapter() { return &video_adapter_; } 235 CoordinatedVideoAdapter* video_adapter() { return &video_adapter_; }
250 236
251 void SetCaptureState(CaptureState state); 237 void SetCaptureState(CaptureState state);
252 238
253 // subclasses override this virtual method to provide a vector of fourccs, in 239 // subclasses override this virtual method to provide a vector of fourccs, in
254 // order of preference, that are expected by the media engine. 240 // order of preference, that are expected by the media engine.
255 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0; 241 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0;
256 242
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 304
319 // Whether capturer should apply rotation to the frame before signaling it. 305 // Whether capturer should apply rotation to the frame before signaling it.
320 bool apply_rotation_; 306 bool apply_rotation_;
321 307
322 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); 308 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer);
323 }; 309 };
324 310
325 } // namespace cricket 311 } // namespace cricket
326 312
327 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ 313 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698