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/base/scoped_ref_ptr.h" | 18 #include "webrtc/base/scoped_ref_ptr.h" |
19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
20 #include "webrtc/common_video/rotation.h" | 20 #include "webrtc/common_video/rotation.h" |
21 #include "webrtc/modules/video_capture/video_capture.h" | 21 #include "webrtc/modules/video_capture/video_capture.h" |
22 #include "webrtc/modules/video_capture/video_capture_config.h" | 22 #include "webrtc/modules/video_capture/video_capture_config.h" |
23 #include "webrtc/system_wrappers/include/tick_util.h" | |
24 #include "webrtc/video_frame.h" | 23 #include "webrtc/video_frame.h" |
25 | 24 |
26 namespace webrtc | 25 namespace webrtc |
27 { | 26 { |
28 class CriticalSectionWrapper; | 27 class CriticalSectionWrapper; |
29 | 28 |
30 namespace videocapturemodule { | 29 namespace videocapturemodule { |
31 // Class definitions | 30 // Class definitions |
32 class VideoCaptureImpl: public VideoCaptureModule, public VideoCaptureExternal | 31 class VideoCaptureImpl: public VideoCaptureModule, public VideoCaptureExternal |
33 { | 32 { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 virtual ~VideoCaptureImpl(); | 108 virtual ~VideoCaptureImpl(); |
110 int32_t DeliverCapturedFrame(VideoFrame& captureFrame); | 109 int32_t DeliverCapturedFrame(VideoFrame& captureFrame); |
111 | 110 |
112 int32_t _id; // Module ID | 111 int32_t _id; // Module ID |
113 char* _deviceUniqueId; // current Device unique name; | 112 char* _deviceUniqueId; // current Device unique name; |
114 CriticalSectionWrapper& _apiCs; | 113 CriticalSectionWrapper& _apiCs; |
115 int32_t _captureDelay; // Current capture delay. May be changed of platform
dependent parts. | 114 int32_t _captureDelay; // Current capture delay. May be changed of platform
dependent parts. |
116 VideoCaptureCapability _requestedCapability; // Should be set by platform de
pendent code in StartCapture. | 115 VideoCaptureCapability _requestedCapability; // Should be set by platform de
pendent code in StartCapture. |
117 private: | 116 private: |
118 void UpdateFrameCount(); | 117 void UpdateFrameCount(); |
119 uint32_t CalculateFrameRate(const TickTime& now); | 118 uint32_t CalculateFrameRate(int64_t now_ns); |
120 | 119 |
121 CriticalSectionWrapper& _callBackCs; | 120 CriticalSectionWrapper& _callBackCs; |
122 | 121 |
123 TickTime _lastProcessTime; // last time the module process function was call
ed. | 122 // last time the module process function was called. |
124 TickTime _lastFrameRateCallbackTime; // last time the frame rate callback fu
nction was called. | 123 int64_t _lastProcessTimeNanos; |
| 124 // last time the frame rate callback function was called. |
| 125 int64_t _lastFrameRateCallbackTimeNanos; |
125 bool _frameRateCallBack; // true if EnableFrameRateCallback | 126 bool _frameRateCallBack; // true if EnableFrameRateCallback |
126 bool _noPictureAlarmCallBack; //true if EnableNoPictureAlarm | 127 bool _noPictureAlarmCallBack; //true if EnableNoPictureAlarm |
127 VideoCaptureAlarm _captureAlarm; // current value of the noPictureAlarm | 128 VideoCaptureAlarm _captureAlarm; // current value of the noPictureAlarm |
128 | 129 |
129 int32_t _setCaptureDelay; // The currently used capture delay | 130 int32_t _setCaptureDelay; // The currently used capture delay |
130 VideoCaptureDataCallback* _dataCallBack; | 131 VideoCaptureDataCallback* _dataCallBack; |
131 VideoCaptureFeedBack* _captureCallBack; | 132 VideoCaptureFeedBack* _captureCallBack; |
132 | 133 |
133 TickTime _lastProcessFrameCount; | 134 int64_t _lastProcessFrameTimeNanos; |
134 TickTime _incomingFrameTimes[kFrameRateCountHistorySize];// timestamp for lo
cal captured frames | 135 // timestamp for local captured frames |
| 136 int64_t _incomingFrameTimesNanos[kFrameRateCountHistorySize]; |
135 VideoRotation _rotateFrame; // Set if the frame should be rotated by the | 137 VideoRotation _rotateFrame; // Set if the frame should be rotated by the |
136 // capture module. | 138 // capture module. |
137 | 139 |
138 VideoFrame _captureFrame; | 140 VideoFrame _captureFrame; |
139 | 141 |
140 // Indicate whether rotation should be applied before delivered externally. | 142 // Indicate whether rotation should be applied before delivered externally. |
141 bool apply_rotation_; | 143 bool apply_rotation_; |
142 }; | 144 }; |
143 } // namespace videocapturemodule | 145 } // namespace videocapturemodule |
144 } // namespace webrtc | 146 } // namespace webrtc |
145 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_ | 147 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_ |
OLD | NEW |