OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 #ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_ |
12 #define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_ | 12 #define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_ |
13 | 13 |
14 /* | 14 /* |
15 * video_capture_impl.h | 15 * video_capture_impl.h |
16 */ | 16 */ |
17 | 17 |
18 #include "webrtc/api/video/video_frame.h" | 18 #include "webrtc/api/video/video_frame.h" |
| 19 #include "webrtc/base/criticalsection.h" |
19 #include "webrtc/base/scoped_ref_ptr.h" | 20 #include "webrtc/base/scoped_ref_ptr.h" |
20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 21 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
21 #include "webrtc/modules/video_capture/video_capture.h" | 22 #include "webrtc/modules/video_capture/video_capture.h" |
22 #include "webrtc/modules/video_capture/video_capture_config.h" | 23 #include "webrtc/modules/video_capture/video_capture_config.h" |
23 | 24 |
24 namespace webrtc | 25 namespace webrtc |
25 { | 26 { |
26 class CriticalSectionWrapper; | |
27 | 27 |
28 namespace videocapturemodule { | 28 namespace videocapturemodule { |
29 // Class definitions | 29 // Class definitions |
30 class VideoCaptureImpl: public VideoCaptureModule, public VideoCaptureExternal | 30 class VideoCaptureImpl: public VideoCaptureModule, public VideoCaptureExternal |
31 { | 31 { |
32 public: | 32 public: |
33 | 33 |
34 /* | 34 /* |
35 * Create a video capture module object | 35 * Create a video capture module object |
36 * | 36 * |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 bool CaptureStarted() override {return false; } | 86 bool CaptureStarted() override {return false; } |
87 int32_t CaptureSettings(VideoCaptureCapability& /*settings*/) override | 87 int32_t CaptureSettings(VideoCaptureCapability& /*settings*/) override |
88 { return -1; } | 88 { return -1; } |
89 | 89 |
90 protected: | 90 protected: |
91 VideoCaptureImpl(); | 91 VideoCaptureImpl(); |
92 virtual ~VideoCaptureImpl(); | 92 virtual ~VideoCaptureImpl(); |
93 int32_t DeliverCapturedFrame(VideoFrame& captureFrame); | 93 int32_t DeliverCapturedFrame(VideoFrame& captureFrame); |
94 | 94 |
95 char* _deviceUniqueId; // current Device unique name; | 95 char* _deviceUniqueId; // current Device unique name; |
96 CriticalSectionWrapper& _apiCs; | 96 rtc::CriticalSection _apiCs; |
97 VideoCaptureCapability _requestedCapability; // Should be set by platform de
pendent code in StartCapture. | 97 VideoCaptureCapability _requestedCapability; // Should be set by platform de
pendent code in StartCapture. |
98 private: | 98 private: |
99 void UpdateFrameCount(); | 99 void UpdateFrameCount(); |
100 uint32_t CalculateFrameRate(int64_t now_ns); | 100 uint32_t CalculateFrameRate(int64_t now_ns); |
101 | 101 |
102 // last time the module process function was called. | 102 // last time the module process function was called. |
103 int64_t _lastProcessTimeNanos; | 103 int64_t _lastProcessTimeNanos; |
104 // last time the frame rate callback function was called. | 104 // last time the frame rate callback function was called. |
105 int64_t _lastFrameRateCallbackTimeNanos; | 105 int64_t _lastFrameRateCallbackTimeNanos; |
106 | 106 |
107 rtc::VideoSinkInterface<VideoFrame>* _dataCallBack; | 107 rtc::VideoSinkInterface<VideoFrame>* _dataCallBack; |
108 | 108 |
109 int64_t _lastProcessFrameTimeNanos; | 109 int64_t _lastProcessFrameTimeNanos; |
110 // timestamp for local captured frames | 110 // timestamp for local captured frames |
111 int64_t _incomingFrameTimesNanos[kFrameRateCountHistorySize]; | 111 int64_t _incomingFrameTimesNanos[kFrameRateCountHistorySize]; |
112 VideoRotation _rotateFrame; // Set if the frame should be rotated by the | 112 VideoRotation _rotateFrame; // Set if the frame should be rotated by the |
113 // capture module. | 113 // capture module. |
114 | 114 |
115 // Indicate whether rotation should be applied before delivered externally. | 115 // Indicate whether rotation should be applied before delivered externally. |
116 bool apply_rotation_; | 116 bool apply_rotation_; |
117 }; | 117 }; |
118 } // namespace videocapturemodule | 118 } // namespace videocapturemodule |
119 } // namespace webrtc | 119 } // namespace webrtc |
120 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_ | 120 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_ |
OLD | NEW |