Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 16 matching lines...) Expand all Loading... | |
| 27 char device_name[256]; | 27 char device_name[256]; |
| 28 char unique_name[256]; | 28 char unique_name[256]; |
| 29 if (device_info->GetDeviceName(0, device_name, sizeof(device_name), | 29 if (device_info->GetDeviceName(0, device_name, sizeof(device_name), |
| 30 unique_name, sizeof(unique_name)) != | 30 unique_name, sizeof(unique_name)) != |
| 31 0) { | 31 0) { |
| 32 Destroy(); | 32 Destroy(); |
| 33 return false; | 33 return false; |
| 34 } | 34 } |
| 35 | 35 |
| 36 vcm_ = webrtc::VideoCaptureFactory::Create(0, unique_name); | 36 vcm_ = webrtc::VideoCaptureFactory::Create(0, unique_name); |
| 37 vcm_->AddRef(); | |
|
pbos-webrtc
2015/11/26 17:12:12
Shouldn't this be done inside ::Create() maybe? Cr
| |
| 38 | |
| 37 vcm_->RegisterCaptureDataCallback(*this); | 39 vcm_->RegisterCaptureDataCallback(*this); |
| 38 | 40 |
| 39 device_info->GetCapability(vcm_->CurrentDeviceName(), 0, capability_); | 41 device_info->GetCapability(vcm_->CurrentDeviceName(), 0, capability_); |
| 40 delete device_info; | 42 delete device_info; |
| 41 | 43 |
| 42 capability_.width = static_cast<int32_t>(width); | 44 capability_.width = static_cast<int32_t>(width); |
| 43 capability_.height = static_cast<int32_t>(height); | 45 capability_.height = static_cast<int32_t>(height); |
| 44 capability_.maxFPS = static_cast<int32_t>(target_fps); | 46 capability_.maxFPS = static_cast<int32_t>(target_fps); |
| 45 capability_.rawType = kVideoI420; | 47 capability_.rawType = kVideoI420; |
| 46 | 48 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 | 82 |
| 81 void VcmCapturer::Destroy() { | 83 void VcmCapturer::Destroy() { |
| 82 if (vcm_ == NULL) { | 84 if (vcm_ == NULL) { |
| 83 return; | 85 return; |
| 84 } | 86 } |
| 85 | 87 |
| 86 vcm_->StopCapture(); | 88 vcm_->StopCapture(); |
| 87 vcm_->DeRegisterCaptureDataCallback(); | 89 vcm_->DeRegisterCaptureDataCallback(); |
| 88 vcm_->Release(); | 90 vcm_->Release(); |
| 89 | 91 |
| 90 // TODO(pbos): How do I destroy the VideoCaptureModule? This still leaves | |
| 91 // non-freed memory. | |
| 92 vcm_ = NULL; | 92 vcm_ = NULL; |
| 93 } | 93 } |
| 94 | 94 |
| 95 VcmCapturer::~VcmCapturer() { Destroy(); } | 95 VcmCapturer::~VcmCapturer() { Destroy(); } |
| 96 | 96 |
| 97 void VcmCapturer::OnIncomingCapturedFrame(const int32_t id, | 97 void VcmCapturer::OnIncomingCapturedFrame(const int32_t id, |
| 98 const VideoFrame& frame) { | 98 const VideoFrame& frame) { |
| 99 rtc::CritScope lock(&crit_); | 99 rtc::CritScope lock(&crit_); |
| 100 if (started_) | 100 if (started_) |
| 101 input_->IncomingCapturedFrame(frame); | 101 input_->IncomingCapturedFrame(frame); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void VcmCapturer::OnCaptureDelayChanged(const int32_t id, const int32_t delay) { | 104 void VcmCapturer::OnCaptureDelayChanged(const int32_t id, const int32_t delay) { |
| 105 } | 105 } |
| 106 } // test | 106 } // test |
| 107 } // webrtc | 107 } // webrtc |
| OLD | NEW |