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

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

Issue 1836043004: Cleanup the VideoAdapter (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed scale size 0. Created 4 years, 8 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called. 226 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called.
227 void OnFrameCaptured(VideoCapturer* video_capturer, 227 void OnFrameCaptured(VideoCapturer* video_capturer,
228 const CapturedFrame* captured_frame); 228 const CapturedFrame* captured_frame);
229 229
230 // Called when a frame has been captured and converted to a VideoFrame. 230 // Called when a frame has been captured and converted to a VideoFrame.
231 // OnFrame can be called directly by an implementation that does not use 231 // OnFrame can be called directly by an implementation that does not use
232 // SignalFrameCaptured or OnFrameCaptured. 232 // SignalFrameCaptured or OnFrameCaptured.
233 void OnFrame(VideoCapturer* capturer, const VideoFrame* frame); 233 void OnFrame(VideoCapturer* capturer, const VideoFrame* frame);
234 234
235 CoordinatedVideoAdapter* video_adapter() { return &video_adapter_; } 235 VideoAdapter* video_adapter() { return &video_adapter_; }
236 236
237 void SetCaptureState(CaptureState state); 237 void SetCaptureState(CaptureState state);
238 238
239 // 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
240 // order of preference, that are expected by the media engine. 240 // order of preference, that are expected by the media engine.
241 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0; 241 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0;
242 242
243 // mutators to set private attributes 243 // mutators to set private attributes
244 void SetId(const std::string& id) { 244 void SetId(const std::string& id) {
245 id_ = id; 245 id_ = id;
246 } 246 }
247 247
248 void SetCaptureFormat(const VideoFormat* format) { 248 void SetCaptureFormat(const VideoFormat* format) {
249 capture_format_.reset(format ? new VideoFormat(*format) : NULL); 249 capture_format_.reset(format ? new VideoFormat(*format) : NULL);
250 if (capture_format_) { 250 if (capture_format_) {
251 ASSERT(capture_format_->interval > 0 && 251 ASSERT(capture_format_->interval > 0 &&
252 "Capture format expected to have positive interval."); 252 "Capture format expected to have positive interval.");
253 // Video adapter really only cares about capture format interval. 253 video_adapter_.SetExpectedInputFrameInterval(capture_format_->interval);
254 video_adapter_.SetInputFormat(*capture_format_);
255 } 254 }
256 } 255 }
257 256
258 void SetSupportedFormats(const std::vector<VideoFormat>& formats); 257 void SetSupportedFormats(const std::vector<VideoFormat>& formats);
259 VideoFrameFactory* frame_factory() { return frame_factory_.get(); } 258 VideoFrameFactory* frame_factory() { return frame_factory_.get(); }
260 259
261 private: 260 private:
262 void Construct(); 261 void Construct();
263 // Get the distance between the desired format and the supported format. 262 // Get the distance between the desired format and the supported format.
264 // Return the max distance if they mismatch. See the implementation for 263 // Return the max distance if they mismatch. See the implementation for
(...skipping 23 matching lines...) Expand all
288 287
289 int ratio_w_; // View resolution. e.g. 1280 x 720. 288 int ratio_w_; // View resolution. e.g. 1280 x 720.
290 int ratio_h_; 289 int ratio_h_;
291 bool enable_camera_list_; 290 bool enable_camera_list_;
292 bool square_pixel_aspect_ratio_; // Enable scaling to square pixels. 291 bool square_pixel_aspect_ratio_; // Enable scaling to square pixels.
293 int scaled_width_; // Current output size from ComputeScale. 292 int scaled_width_; // Current output size from ComputeScale.
294 int scaled_height_; 293 int scaled_height_;
295 294
296 rtc::VideoBroadcaster broadcaster_; 295 rtc::VideoBroadcaster broadcaster_;
297 bool enable_video_adapter_; 296 bool enable_video_adapter_;
298 CoordinatedVideoAdapter video_adapter_; 297 VideoAdapter video_adapter_;
299 298
300 rtc::CriticalSection frame_stats_crit_; 299 rtc::CriticalSection frame_stats_crit_;
301 300
302 // The captured frame format before potential adapation. 301 // The captured frame format before potential adapation.
303 VideoFormat last_captured_frame_format_; 302 VideoFormat last_captured_frame_format_;
304 303
305 // Whether capturer should apply rotation to the frame before signaling it. 304 // Whether capturer should apply rotation to the frame before signaling it.
306 bool apply_rotation_; 305 bool apply_rotation_;
307 306
308 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); 307 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer);
309 }; 308 };
310 309
311 } // namespace cricket 310 } // namespace cricket
312 311
313 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ 312 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698