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

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: Addressed sprangs comments. 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called. 224 // Callback attached to SignalFrameCaptured where SignalVideoFrames is called.
225 void OnFrameCaptured(VideoCapturer* video_capturer, 225 void OnFrameCaptured(VideoCapturer* video_capturer,
226 const CapturedFrame* captured_frame); 226 const CapturedFrame* captured_frame);
227 227
228 // Called when a frame has been captured and converted to a VideoFrame. 228 // Called when a frame has been captured and converted to a VideoFrame.
229 // OnFrame can be called directly by an implementation that does not use 229 // OnFrame can be called directly by an implementation that does not use
230 // SignalFrameCaptured or OnFrameCaptured. 230 // SignalFrameCaptured or OnFrameCaptured.
231 void OnFrame(VideoCapturer* capturer, const VideoFrame* frame); 231 void OnFrame(VideoCapturer* capturer, const VideoFrame* frame);
232 232
233 CoordinatedVideoAdapter* video_adapter() { return &video_adapter_; } 233 VideoAdapter* video_adapter() { return &video_adapter_; }
234 234
235 void SetCaptureState(CaptureState state); 235 void SetCaptureState(CaptureState state);
236 236
237 // subclasses override this virtual method to provide a vector of fourccs, in 237 // subclasses override this virtual method to provide a vector of fourccs, in
238 // order of preference, that are expected by the media engine. 238 // order of preference, that are expected by the media engine.
239 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0; 239 virtual bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) = 0;
240 240
241 // mutators to set private attributes 241 // mutators to set private attributes
242 void SetId(const std::string& id) { 242 void SetId(const std::string& id) {
243 id_ = id; 243 id_ = id;
244 } 244 }
245 245
246 void SetCaptureFormat(const VideoFormat* format) { 246 void SetCaptureFormat(const VideoFormat* format) {
247 capture_format_.reset(format ? new VideoFormat(*format) : NULL); 247 capture_format_.reset(format ? new VideoFormat(*format) : NULL);
248 if (capture_format_) { 248 if (capture_format_) {
249 ASSERT(capture_format_->interval > 0 && 249 ASSERT(capture_format_->interval > 0 &&
250 "Capture format expected to have positive interval."); 250 "Capture format expected to have positive interval.");
251 // Video adapter really only cares about capture format interval. 251 video_adapter_.SetExpectedInputFrameInterval(capture_format_->interval);
252 video_adapter_.SetInputFormat(*capture_format_);
253 } 252 }
254 } 253 }
255 254
256 void SetSupportedFormats(const std::vector<VideoFormat>& formats); 255 void SetSupportedFormats(const std::vector<VideoFormat>& formats);
257 VideoFrameFactory* frame_factory() { return frame_factory_.get(); } 256 VideoFrameFactory* frame_factory() { return frame_factory_.get(); }
258 257
259 private: 258 private:
260 void Construct(); 259 void Construct();
261 // Get the distance between the desired format and the supported format. 260 // Get the distance between the desired format and the supported format.
262 // Return the max distance if they mismatch. See the implementation for 261 // Return the max distance if they mismatch. See the implementation for
(...skipping 23 matching lines...) Expand all
286 285
287 int ratio_w_; // View resolution. e.g. 1280 x 720. 286 int ratio_w_; // View resolution. e.g. 1280 x 720.
288 int ratio_h_; 287 int ratio_h_;
289 bool enable_camera_list_; 288 bool enable_camera_list_;
290 bool square_pixel_aspect_ratio_; // Enable scaling to square pixels. 289 bool square_pixel_aspect_ratio_; // Enable scaling to square pixels.
291 int scaled_width_; // Current output size from ComputeScale. 290 int scaled_width_; // Current output size from ComputeScale.
292 int scaled_height_; 291 int scaled_height_;
293 292
294 rtc::VideoBroadcaster broadcaster_; 293 rtc::VideoBroadcaster broadcaster_;
295 bool enable_video_adapter_; 294 bool enable_video_adapter_;
296 CoordinatedVideoAdapter video_adapter_; 295 VideoAdapter video_adapter_;
297 296
298 rtc::CriticalSection frame_stats_crit_; 297 rtc::CriticalSection frame_stats_crit_;
299 // The captured frame size before potential adapation. 298 // The captured frame size before potential adapation.
300 bool input_size_valid_ GUARDED_BY(frame_stats_crit_) = false; 299 bool input_size_valid_ GUARDED_BY(frame_stats_crit_) = false;
301 int input_width_ GUARDED_BY(frame_stats_crit_); 300 int input_width_ GUARDED_BY(frame_stats_crit_);
302 int input_height_ GUARDED_BY(frame_stats_crit_); 301 int input_height_ GUARDED_BY(frame_stats_crit_);
sprang 2016/04/05 08:28:35 Did you revert the change i rev 7, why? In any cas
perkj_webrtc 2016/04/05 10:03:03 I have only rebased.
303 302
304 // Whether capturer should apply rotation to the frame before signaling it. 303 // Whether capturer should apply rotation to the frame before signaling it.
305 bool apply_rotation_; 304 bool apply_rotation_;
306 305
307 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); 306 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer);
308 }; 307 };
309 308
310 } // namespace cricket 309 } // namespace cricket
311 310
312 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ 311 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698