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 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // returns the number of milliseconds until the module want a worker thread to c
all Process | 86 // returns the number of milliseconds until the module want a worker thread to c
all Process |
87 int64_t VideoCaptureImpl::TimeUntilNextProcess() | 87 int64_t VideoCaptureImpl::TimeUntilNextProcess() |
88 { | 88 { |
89 CriticalSectionScoped cs(&_callBackCs); | 89 CriticalSectionScoped cs(&_callBackCs); |
90 const int64_t kProcessIntervalMs = 300; | 90 const int64_t kProcessIntervalMs = 300; |
91 return kProcessIntervalMs - | 91 return kProcessIntervalMs - |
92 (TickTime::Now() - _lastProcessTime).Milliseconds(); | 92 (TickTime::Now() - _lastProcessTime).Milliseconds(); |
93 } | 93 } |
94 | 94 |
95 // Process any pending tasks such as timeouts | 95 // Process any pending tasks such as timeouts |
96 int32_t VideoCaptureImpl::Process() | 96 void VideoCaptureImpl::Process() |
97 { | 97 { |
98 CriticalSectionScoped cs(&_callBackCs); | 98 CriticalSectionScoped cs(&_callBackCs); |
99 | 99 |
100 const TickTime now = TickTime::Now(); | 100 const TickTime now = TickTime::Now(); |
101 _lastProcessTime = TickTime::Now(); | 101 _lastProcessTime = TickTime::Now(); |
102 | 102 |
103 // Handle No picture alarm | 103 // Handle No picture alarm |
104 | 104 |
105 if (_lastProcessFrameCount.Ticks() == _incomingFrameTimes[0].Ticks() && | 105 if (_lastProcessFrameCount.Ticks() == _incomingFrameTimes[0].Ticks() && |
106 _captureAlarm != Raised) | 106 _captureAlarm != Raised) |
(...skipping 22 matching lines...) Expand all Loading... |
129 if (_frameRateCallBack && _captureCallBack) | 129 if (_frameRateCallBack && _captureCallBack) |
130 { | 130 { |
131 const uint32_t frameRate = CalculateFrameRate(now); | 131 const uint32_t frameRate = CalculateFrameRate(now); |
132 _captureCallBack->OnCaptureFrameRate(_id, frameRate); | 132 _captureCallBack->OnCaptureFrameRate(_id, frameRate); |
133 } | 133 } |
134 _lastFrameRateCallbackTime = now; // Can be set by EnableFrameRateCallba
ck | 134 _lastFrameRateCallbackTime = now; // Can be set by EnableFrameRateCallba
ck |
135 | 135 |
136 } | 136 } |
137 | 137 |
138 _lastProcessFrameCount = _incomingFrameTimes[0]; | 138 _lastProcessFrameCount = _incomingFrameTimes[0]; |
139 | |
140 return 0; | |
141 } | 139 } |
142 | 140 |
143 VideoCaptureImpl::VideoCaptureImpl(const int32_t id) | 141 VideoCaptureImpl::VideoCaptureImpl(const int32_t id) |
144 : _id(id), | 142 : _id(id), |
145 _deviceUniqueId(NULL), | 143 _deviceUniqueId(NULL), |
146 _apiCs(*CriticalSectionWrapper::CreateCriticalSection()), | 144 _apiCs(*CriticalSectionWrapper::CreateCriticalSection()), |
147 _captureDelay(0), | 145 _captureDelay(0), |
148 _requestedCapability(), | 146 _requestedCapability(), |
149 _callBackCs(*CriticalSectionWrapper::CreateCriticalSection()), | 147 _callBackCs(*CriticalSectionWrapper::CreateCriticalSection()), |
150 _lastProcessTime(TickTime::Now()), | 148 _lastProcessTime(TickTime::Now()), |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 if (diff > 0) | 388 if (diff > 0) |
391 { | 389 { |
392 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); | 390 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); |
393 } | 391 } |
394 } | 392 } |
395 | 393 |
396 return nrOfFrames; | 394 return nrOfFrames; |
397 } | 395 } |
398 } // namespace videocapturemodule | 396 } // namespace videocapturemodule |
399 } // namespace webrtc | 397 } // namespace webrtc |
OLD | NEW |