| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 *degrees = 180; | 73 *degrees = 180; |
| 74 return 0; | 74 return 0; |
| 75 case kVideoRotation_270: | 75 case kVideoRotation_270: |
| 76 *degrees = 270; | 76 *degrees = 270; |
| 77 return 0; | 77 return 0; |
| 78 } | 78 } |
| 79 return -1; | 79 return -1; |
| 80 } | 80 } |
| 81 | 81 |
| 82 VideoCaptureImpl::VideoCaptureImpl() | 82 VideoCaptureImpl::VideoCaptureImpl() |
| 83 : _deviceUniqueId(NULL), | 83 : _deviceUniqueId(nullptr), |
| 84 _apiCs(*CriticalSectionWrapper::CreateCriticalSection()), | 84 _apiCs(*CriticalSectionWrapper::CreateCriticalSection()), |
| 85 _captureDelay(0), | 85 _captureDelay(0), |
| 86 _requestedCapability(), | 86 _requestedCapability(), |
| 87 _lastProcessTimeNanos(rtc::TimeNanos()), | 87 _lastProcessTimeNanos(rtc::TimeNanos()), |
| 88 _lastFrameRateCallbackTimeNanos(rtc::TimeNanos()), | 88 _lastFrameRateCallbackTimeNanos(rtc::TimeNanos()), |
| 89 _dataCallBack(NULL), | 89 _dataCallBack(nullptr), |
| 90 _lastProcessFrameTimeNanos(rtc::TimeNanos()), | 90 _lastProcessFrameTimeNanos(rtc::TimeNanos()), |
| 91 _rotateFrame(kVideoRotation_0), | 91 _rotateFrame(kVideoRotation_0), |
| 92 apply_rotation_(false) { | 92 apply_rotation_(false) { |
| 93 _requestedCapability.width = kDefaultWidth; | 93 _requestedCapability.width = kDefaultWidth; |
| 94 _requestedCapability.height = kDefaultHeight; | 94 _requestedCapability.height = kDefaultHeight; |
| 95 _requestedCapability.maxFPS = 30; | 95 _requestedCapability.maxFPS = 30; |
| 96 _requestedCapability.rawType = kVideoI420; | 96 _requestedCapability.rawType = kVideoI420; |
| 97 _requestedCapability.codecType = kVideoCodecUnknown; | 97 _requestedCapability.codecType = kVideoCodecUnknown; |
| 98 memset(_incomingFrameTimesNanos, 0, sizeof(_incomingFrameTimesNanos)); | 98 memset(_incomingFrameTimesNanos, 0, sizeof(_incomingFrameTimesNanos)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 VideoCaptureImpl::~VideoCaptureImpl() | 101 VideoCaptureImpl::~VideoCaptureImpl() |
| 102 { | 102 { |
| 103 DeRegisterCaptureDataCallback(); | 103 DeRegisterCaptureDataCallback(); |
| 104 delete &_apiCs; | 104 delete &_apiCs; |
| 105 | 105 |
| 106 if (_deviceUniqueId) | 106 if (_deviceUniqueId) |
| 107 delete[] _deviceUniqueId; | 107 delete[] _deviceUniqueId; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void VideoCaptureImpl::RegisterCaptureDataCallback( | 110 void VideoCaptureImpl::RegisterCaptureDataCallback( |
| 111 rtc::VideoSinkInterface<VideoFrame>* dataCallBack) { | 111 rtc::VideoSinkInterface<VideoFrame>* dataCallBack) { |
| 112 CriticalSectionScoped cs(&_apiCs); | 112 CriticalSectionScoped cs(&_apiCs); |
| 113 _dataCallBack = dataCallBack; | 113 _dataCallBack = dataCallBack; |
| 114 } | 114 } |
| 115 | 115 |
| 116 void VideoCaptureImpl::DeRegisterCaptureDataCallback() { | 116 void VideoCaptureImpl::DeRegisterCaptureDataCallback() { |
| 117 CriticalSectionScoped cs(&_apiCs); | 117 CriticalSectionScoped cs(&_apiCs); |
| 118 _dataCallBack = NULL; | 118 _dataCallBack = nullptr; |
| 119 } | 119 } |
| 120 int32_t VideoCaptureImpl::DeliverCapturedFrame(VideoFrame& captureFrame) { | 120 int32_t VideoCaptureImpl::DeliverCapturedFrame(VideoFrame& captureFrame) { |
| 121 UpdateFrameCount(); // frame count used for local frame rate callback. | 121 UpdateFrameCount(); // frame count used for local frame rate callback. |
| 122 | 122 |
| 123 if (_dataCallBack) { | 123 if (_dataCallBack) { |
| 124 _dataCallBack->OnFrame(captureFrame); | 124 _dataCallBack->OnFrame(captureFrame); |
| 125 } | 125 } |
| 126 | 126 |
| 127 return 0; | 127 return 0; |
| 128 } | 128 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 if (diff > 0) | 261 if (diff > 0) |
| 262 { | 262 { |
| 263 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); | 263 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 | 266 |
| 267 return nrOfFrames; | 267 return nrOfFrames; |
| 268 } | 268 } |
| 269 } // namespace videocapturemodule | 269 } // namespace videocapturemodule |
| 270 } // namespace webrtc | 270 } // namespace webrtc |
| OLD | NEW |