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 |
| 11 #include "webrtc/base/refcount.h" |
| 12 #include "webrtc/base/scoped_ref_ptr.h" |
11 #include "webrtc/modules/video_capture/windows/video_capture_ds.h" | 13 #include "webrtc/modules/video_capture/windows/video_capture_ds.h" |
12 #include "webrtc/modules/video_capture/windows/video_capture_mf.h" | 14 #include "webrtc/modules/video_capture/windows/video_capture_mf.h" |
13 #include "webrtc/system_wrappers/include/ref_count.h" | |
14 | 15 |
15 namespace webrtc { | 16 namespace webrtc { |
16 namespace videocapturemodule { | 17 namespace videocapturemodule { |
17 | 18 |
18 // static | 19 // static |
19 VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo( | 20 VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo( |
20 const int32_t id) { | 21 const int32_t id) { |
21 // TODO(tommi): Use the Media Foundation version on Vista and up. | 22 // TODO(tommi): Use the Media Foundation version on Vista and up. |
22 return DeviceInfoDS::Create(id); | 23 return DeviceInfoDS::Create(id); |
23 } | 24 } |
24 | 25 |
25 VideoCaptureModule* VideoCaptureImpl::Create(const int32_t id, | 26 rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create( |
26 const char* device_id) { | 27 const int32_t id, |
27 if (device_id == NULL) | 28 const char* device_id) { |
28 return NULL; | 29 if (device_id == nullptr) |
| 30 return nullptr; |
29 | 31 |
30 // TODO(tommi): Use Media Foundation implementation for Vista and up. | 32 // TODO(tommi): Use Media Foundation implementation for Vista and up. |
31 RefCountImpl<VideoCaptureDS>* capture = new RefCountImpl<VideoCaptureDS>(id); | 33 rtc::scoped_refptr<VideoCaptureDS> capture( |
| 34 new rtc::RefCountedObject<VideoCaptureDS>(id)); |
32 if (capture->Init(id, device_id) != 0) { | 35 if (capture->Init(id, device_id) != 0) { |
33 delete capture; | 36 return nullptr; |
34 capture = NULL; | |
35 } | 37 } |
36 | 38 |
37 return capture; | 39 return capture; |
38 } | 40 } |
39 | 41 |
40 } // namespace videocapturemodule | 42 } // namespace videocapturemodule |
41 } // namespace webrtc | 43 } // namespace webrtc |
OLD | NEW |