| 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 |
| 11 #include "webrtc/test/vcm_capturer.h" | 11 #include "webrtc/test/vcm_capturer.h" |
| 12 | 12 |
| 13 #include "webrtc/modules/video_capture/video_capture_factory.h" | 13 #include "webrtc/modules/video_capture/video_capture_factory.h" |
| 14 #include "webrtc/video_send_stream.h" | 14 #include "webrtc/video_send_stream.h" |
| 15 | 15 |
| 16 namespace webrtc { | 16 namespace webrtc { |
| 17 namespace test { | 17 namespace test { |
| 18 | 18 |
| 19 VcmCapturer::VcmCapturer() : started_(false), sink_(nullptr), vcm_(NULL) {} | 19 VcmCapturer::VcmCapturer() : started_(false), sink_(nullptr), vcm_(nullptr) {} |
| 20 | 20 |
| 21 bool VcmCapturer::Init(size_t width, size_t height, size_t target_fps) { | 21 bool VcmCapturer::Init(size_t width, size_t height, size_t target_fps) { |
| 22 VideoCaptureModule::DeviceInfo* device_info = | 22 VideoCaptureModule::DeviceInfo* device_info = |
| 23 VideoCaptureFactory::CreateDeviceInfo(); | 23 VideoCaptureFactory::CreateDeviceInfo(); |
| 24 | 24 |
| 25 char device_name[256]; | 25 char device_name[256]; |
| 26 char unique_name[256]; | 26 char unique_name[256]; |
| 27 if (device_info->GetDeviceName(0, device_name, sizeof(device_name), | 27 if (device_info->GetDeviceName(0, device_name, sizeof(device_name), |
| 28 unique_name, sizeof(unique_name)) != | 28 unique_name, sizeof(unique_name)) != |
| 29 0) { | 29 0) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 52 return true; | 52 return true; |
| 53 } | 53 } |
| 54 | 54 |
| 55 VcmCapturer* VcmCapturer::Create(size_t width, | 55 VcmCapturer* VcmCapturer::Create(size_t width, |
| 56 size_t height, | 56 size_t height, |
| 57 size_t target_fps) { | 57 size_t target_fps) { |
| 58 VcmCapturer* vcm_capturer = new VcmCapturer(); | 58 VcmCapturer* vcm_capturer = new VcmCapturer(); |
| 59 if (!vcm_capturer->Init(width, height, target_fps)) { | 59 if (!vcm_capturer->Init(width, height, target_fps)) { |
| 60 // TODO(pbos): Log a warning that this failed. | 60 // TODO(pbos): Log a warning that this failed. |
| 61 delete vcm_capturer; | 61 delete vcm_capturer; |
| 62 return NULL; | 62 return nullptr; |
| 63 } | 63 } |
| 64 return vcm_capturer; | 64 return vcm_capturer; |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 void VcmCapturer::Start() { | 68 void VcmCapturer::Start() { |
| 69 rtc::CritScope lock(&crit_); | 69 rtc::CritScope lock(&crit_); |
| 70 started_ = true; | 70 started_ = true; |
| 71 } | 71 } |
| 72 | 72 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 101 VcmCapturer::~VcmCapturer() { Destroy(); } | 101 VcmCapturer::~VcmCapturer() { Destroy(); } |
| 102 | 102 |
| 103 void VcmCapturer::OnFrame(const VideoFrame& frame) { | 103 void VcmCapturer::OnFrame(const VideoFrame& frame) { |
| 104 rtc::CritScope lock(&crit_); | 104 rtc::CritScope lock(&crit_); |
| 105 if (started_ && sink_) | 105 if (started_ && sink_) |
| 106 sink_->OnFrame(frame); | 106 sink_->OnFrame(frame); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // test | 109 } // test |
| 110 } // webrtc | 110 } // webrtc |
| OLD | NEW |