| 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  | 
|   37   vcm_->RegisterCaptureDataCallback(*this); |   38   vcm_->RegisterCaptureDataCallback(*this); | 
|   38  |   39  | 
|   39   device_info->GetCapability(vcm_->CurrentDeviceName(), 0, capability_); |   40   device_info->GetCapability(vcm_->CurrentDeviceName(), 0, capability_); | 
|   40   delete device_info; |   41   delete device_info; | 
|   41  |   42  | 
|   42   capability_.width = static_cast<int32_t>(width); |   43   capability_.width = static_cast<int32_t>(width); | 
|   43   capability_.height = static_cast<int32_t>(height); |   44   capability_.height = static_cast<int32_t>(height); | 
|   44   capability_.maxFPS = static_cast<int32_t>(target_fps); |   45   capability_.maxFPS = static_cast<int32_t>(target_fps); | 
|   45   capability_.rawType = kVideoI420; |   46   capability_.rawType = kVideoI420; | 
|   46  |   47  | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   80  |   81  | 
|   81 void VcmCapturer::Destroy() { |   82 void VcmCapturer::Destroy() { | 
|   82   if (vcm_ == NULL) { |   83   if (vcm_ == NULL) { | 
|   83     return; |   84     return; | 
|   84   } |   85   } | 
|   85  |   86  | 
|   86   vcm_->StopCapture(); |   87   vcm_->StopCapture(); | 
|   87   vcm_->DeRegisterCaptureDataCallback(); |   88   vcm_->DeRegisterCaptureDataCallback(); | 
|   88   vcm_->Release(); |   89   vcm_->Release(); | 
|   89  |   90  | 
|   90   // TODO(pbos): How do I destroy the VideoCaptureModule? This still leaves |  | 
|   91   //             non-freed memory. |  | 
|   92   vcm_ = NULL; |   91   vcm_ = NULL; | 
|   93 } |   92 } | 
|   94  |   93  | 
|   95 VcmCapturer::~VcmCapturer() { Destroy(); } |   94 VcmCapturer::~VcmCapturer() { Destroy(); } | 
|   96  |   95  | 
|   97 void VcmCapturer::OnIncomingCapturedFrame(const int32_t id, |   96 void VcmCapturer::OnIncomingCapturedFrame(const int32_t id, | 
|   98                                           const VideoFrame& frame) { |   97                                           const VideoFrame& frame) { | 
|   99   rtc::CritScope lock(&crit_); |   98   rtc::CritScope lock(&crit_); | 
|  100   if (started_) |   99   if (started_) | 
|  101     input_->IncomingCapturedFrame(frame); |  100     input_->IncomingCapturedFrame(frame); | 
|  102 } |  101 } | 
|  103  |  102  | 
|  104 void VcmCapturer::OnCaptureDelayChanged(const int32_t id, const int32_t delay) { |  103 void VcmCapturer::OnCaptureDelayChanged(const int32_t id, const int32_t delay) { | 
|  105 } |  104 } | 
|  106 }  // test |  105 }  // test | 
|  107 }  // webrtc |  106 }  // webrtc | 
| OLD | NEW |