OLD | NEW |
---|---|
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 // and users must call video_adapter()->OnOutputFormatRequest() | 211 // and users must call video_adapter()->OnOutputFormatRequest() |
212 // to receive frames. | 212 // to receive frames. |
213 bool enable_video_adapter() const { return enable_video_adapter_; } | 213 bool enable_video_adapter() const { return enable_video_adapter_; } |
214 void set_enable_video_adapter(bool enable_video_adapter) { | 214 void set_enable_video_adapter(bool enable_video_adapter) { |
215 enable_video_adapter_ = enable_video_adapter; | 215 enable_video_adapter_ = enable_video_adapter; |
216 } | 216 } |
217 | 217 |
218 // Takes ownership. | 218 // Takes ownership. |
219 void set_frame_factory(VideoFrameFactory* frame_factory); | 219 void set_frame_factory(VideoFrameFactory* frame_factory); |
220 | 220 |
221 // TODO(nisse): Rename function? Or pass the frame format before | |
222 // adaptation in some other way. | |
223 void GetStats(VideoFormat* last_captured_frame_format); | |
224 | |
225 // Implements VideoSourceInterface | 221 // Implements VideoSourceInterface |
226 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 222 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, |
227 const rtc::VideoSinkWants& wants) override; | 223 const rtc::VideoSinkWants& wants) override; |
228 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; | 224 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; |
229 | 225 |
230 protected: | 226 protected: |
231 // Signal the captured and possibly adapted frame to downstream consumers | 227 // Signal the captured and possibly adapted frame to downstream consumers |
232 // such as the encoder. | 228 // such as the encoder. |
233 // TODO(perkj): Remove once it is not used by remoting in Chrome. | 229 // TODO(perkj): Remove once it is not used by remoting in Chrome. |
234 sigslot::signal2<VideoCapturer*, const VideoFrame*, | 230 sigslot::signal2<VideoCapturer*, const VideoFrame*, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 | 278 |
283 // Convert captured frame to readable string for LOG messages. | 279 // Convert captured frame to readable string for LOG messages. |
284 std::string ToString(const CapturedFrame* frame) const; | 280 std::string ToString(const CapturedFrame* frame) const; |
285 | 281 |
286 // Updates filtered_supported_formats_ so that it contains the formats in | 282 // Updates filtered_supported_formats_ so that it contains the formats in |
287 // supported_formats_ that fulfill all applied restrictions. | 283 // supported_formats_ that fulfill all applied restrictions. |
288 void UpdateFilteredSupportedFormats(); | 284 void UpdateFilteredSupportedFormats(); |
289 // Returns true if format doesn't fulfill all applied restrictions. | 285 // Returns true if format doesn't fulfill all applied restrictions. |
290 bool ShouldFilterFormat(const VideoFormat& format) const; | 286 bool ShouldFilterFormat(const VideoFormat& format) const; |
291 | 287 |
292 void UpdateStats(const CapturedFrame* captured_frame); | |
293 | |
294 rtc::ThreadChecker thread_checker_; | 288 rtc::ThreadChecker thread_checker_; |
295 std::string id_; | 289 std::string id_; |
296 CaptureState capture_state_; | 290 CaptureState capture_state_; |
297 std::unique_ptr<VideoFrameFactory> frame_factory_; | 291 std::unique_ptr<VideoFrameFactory> frame_factory_; |
298 std::unique_ptr<VideoFormat> capture_format_; | 292 std::unique_ptr<VideoFormat> capture_format_; |
299 std::vector<VideoFormat> supported_formats_; | 293 std::vector<VideoFormat> supported_formats_; |
300 std::unique_ptr<VideoFormat> max_format_; | 294 std::unique_ptr<VideoFormat> max_format_; |
301 std::vector<VideoFormat> filtered_supported_formats_; | 295 std::vector<VideoFormat> filtered_supported_formats_; |
302 | 296 |
303 int ratio_w_; // View resolution. e.g. 1280 x 720. | 297 int ratio_w_; // View resolution. e.g. 1280 x 720. |
304 int ratio_h_; | 298 int ratio_h_; |
305 bool enable_camera_list_; | 299 bool enable_camera_list_; |
306 bool square_pixel_aspect_ratio_; // Enable scaling to square pixels. | 300 bool square_pixel_aspect_ratio_; // Enable scaling to square pixels. |
307 int scaled_width_; // Current output size from ComputeScale. | 301 int scaled_width_; // Current output size from ComputeScale. |
308 int scaled_height_; | 302 int scaled_height_; |
309 | 303 |
310 rtc::VideoBroadcaster broadcaster_; | 304 rtc::VideoBroadcaster broadcaster_; |
311 bool enable_video_adapter_; | 305 bool enable_video_adapter_; |
312 CoordinatedVideoAdapter video_adapter_; | 306 CoordinatedVideoAdapter video_adapter_; |
313 | 307 |
314 rtc::CriticalSection frame_stats_crit_; | 308 rtc::CriticalSection frame_stats_crit_; |
perkj_webrtc
2016/03/22 14:00:42
remove?
nisse-webrtc
2016/03/22 14:16:50
Done.
| |
315 | 309 |
316 // The captured frame format before potential adapation. | |
317 VideoFormat last_captured_frame_format_; | |
318 | |
319 // Whether capturer should apply rotation to the frame before signaling it. | 310 // Whether capturer should apply rotation to the frame before signaling it. |
320 bool apply_rotation_; | 311 bool apply_rotation_; |
321 | 312 |
322 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); | 313 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); |
323 }; | 314 }; |
324 | 315 |
325 } // namespace cricket | 316 } // namespace cricket |
326 | 317 |
327 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ | 318 #endif // WEBRTC_MEDIA_BASE_VIDEOCAPTURER_H_ |
OLD | NEW |