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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // and users must call video_adapter()->OnOutputFormatRequest() | 202 // and users must call video_adapter()->OnOutputFormatRequest() |
203 // to receive frames. | 203 // to receive frames. |
204 bool enable_video_adapter() const { return enable_video_adapter_; } | 204 bool enable_video_adapter() const { return enable_video_adapter_; } |
205 void set_enable_video_adapter(bool enable_video_adapter) { | 205 void set_enable_video_adapter(bool enable_video_adapter) { |
206 enable_video_adapter_ = enable_video_adapter; | 206 enable_video_adapter_ = enable_video_adapter; |
207 } | 207 } |
208 | 208 |
209 // Takes ownership. | 209 // Takes ownership. |
210 void set_frame_factory(VideoFrameFactory* frame_factory); | 210 void set_frame_factory(VideoFrameFactory* frame_factory); |
211 | 211 |
212 // TODO(nisse): Rename function? Or pass the frame format before | 212 bool GetInputSize(int* width, int* height); |
213 // adaptation in some other way. | |
214 void GetStats(VideoFormat* last_captured_frame_format); | |
215 | 213 |
216 // Implements VideoSourceInterface | 214 // Implements VideoSourceInterface |
217 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 215 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, |
218 const rtc::VideoSinkWants& wants) override; | 216 const rtc::VideoSinkWants& wants) override; |
219 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; | 217 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; |
220 | 218 |
221 protected: | 219 protected: |
222 // OnSinkWantsChanged can be overridden to change the default behavior | 220 // OnSinkWantsChanged can be overridden to change the default behavior |
223 // when a sink changes its VideoSinkWants by calling AddOrUpdateSink. | 221 // when a sink changes its VideoSinkWants by calling AddOrUpdateSink. |
224 virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); | 222 virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 266 |
269 // Convert captured frame to readable string for LOG messages. | 267 // Convert captured frame to readable string for LOG messages. |
270 std::string ToString(const CapturedFrame* frame) const; | 268 std::string ToString(const CapturedFrame* frame) const; |
271 | 269 |
272 // Updates filtered_supported_formats_ so that it contains the formats in | 270 // Updates filtered_supported_formats_ so that it contains the formats in |
273 // supported_formats_ that fulfill all applied restrictions. | 271 // supported_formats_ that fulfill all applied restrictions. |
274 void UpdateFilteredSupportedFormats(); | 272 void UpdateFilteredSupportedFormats(); |
275 // Returns true if format doesn't fulfill all applied restrictions. | 273 // Returns true if format doesn't fulfill all applied restrictions. |
276 bool ShouldFilterFormat(const VideoFormat& format) const; | 274 bool ShouldFilterFormat(const VideoFormat& format) const; |
277 | 275 |
278 void UpdateStats(const CapturedFrame* captured_frame); | 276 void UpdateInputSize(const CapturedFrame* captured_frame); |
279 | 277 |
280 rtc::ThreadChecker thread_checker_; | 278 rtc::ThreadChecker thread_checker_; |
281 std::string id_; | 279 std::string id_; |
282 CaptureState capture_state_; | 280 CaptureState capture_state_; |
283 std::unique_ptr<VideoFrameFactory> frame_factory_; | 281 std::unique_ptr<VideoFrameFactory> frame_factory_; |
284 std::unique_ptr<VideoFormat> capture_format_; | 282 std::unique_ptr<VideoFormat> capture_format_; |
285 std::vector<VideoFormat> supported_formats_; | 283 std::vector<VideoFormat> supported_formats_; |
286 std::unique_ptr<VideoFormat> max_format_; | 284 std::unique_ptr<VideoFormat> max_format_; |
287 std::vector<VideoFormat> filtered_supported_formats_; | 285 std::vector<VideoFormat> filtered_supported_formats_; |
288 | 286 |
289 int ratio_w_; // View resolution. e.g. 1280 x 720. | 287 int ratio_w_; // View resolution. e.g. 1280 x 720. |
290 int ratio_h_; | 288 int ratio_h_; |
291 bool enable_camera_list_; | 289 bool enable_camera_list_; |
292 bool square_pixel_aspect_ratio_; // Enable scaling to square pixels. | 290 bool square_pixel_aspect_ratio_; // Enable scaling to square pixels. |
293 int scaled_width_; // Current output size from ComputeScale. | 291 int scaled_width_; // Current output size from ComputeScale. |
294 int scaled_height_; | 292 int scaled_height_; |
295 | 293 |
296 rtc::VideoBroadcaster broadcaster_; | 294 rtc::VideoBroadcaster broadcaster_; |
297 bool enable_video_adapter_; | 295 bool enable_video_adapter_; |
298 CoordinatedVideoAdapter video_adapter_; | 296 CoordinatedVideoAdapter video_adapter_; |
299 | 297 |
300 rtc::CriticalSection frame_stats_crit_; | 298 rtc::CriticalSection frame_stats_crit_; |
301 | 299 // The captured frame size before potential adapation. |
302 // The captured frame format before potential adapation. | 300 bool input_size_valid_ GUARDED_BY(frame_stats_crit_) = false; |
303 VideoFormat last_captured_frame_format_; | 301 int input_width_ GUARDED_BY(frame_stats_crit_); |
| 302 int input_height_ GUARDED_BY(frame_stats_crit_); |
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_ |
OLD | NEW |