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 void VideoCaptureImpl::Process() | 96 int32_t 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; |
139 } | 141 } |
140 | 142 |
141 VideoCaptureImpl::VideoCaptureImpl(const int32_t id) | 143 VideoCaptureImpl::VideoCaptureImpl(const int32_t id) |
142 : _id(id), | 144 : _id(id), |
143 _deviceUniqueId(NULL), | 145 _deviceUniqueId(NULL), |
144 _apiCs(*CriticalSectionWrapper::CreateCriticalSection()), | 146 _apiCs(*CriticalSectionWrapper::CreateCriticalSection()), |
145 _captureDelay(0), | 147 _captureDelay(0), |
146 _requestedCapability(), | 148 _requestedCapability(), |
147 _callBackCs(*CriticalSectionWrapper::CreateCriticalSection()), | 149 _callBackCs(*CriticalSectionWrapper::CreateCriticalSection()), |
148 _lastProcessTime(TickTime::Now()), | 150 _lastProcessTime(TickTime::Now()), |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 if (diff > 0) | 390 if (diff > 0) |
389 { | 391 { |
390 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); | 392 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); |
391 } | 393 } |
392 } | 394 } |
393 | 395 |
394 return nrOfFrames; | 396 return nrOfFrames; |
395 } | 397 } |
396 } // namespace videocapturemodule | 398 } // namespace videocapturemodule |
397 } // namespace webrtc | 399 } // namespace webrtc |
OLD | NEW |