Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: webrtc/modules/video_capture/linux/video_capture_linux.cc

Issue 1477013005: Replace RefCountImpl with rtc::RefCountedObject. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add back explicit Release()s in test Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <errno.h> 11 #include <errno.h>
12 #include <fcntl.h> 12 #include <fcntl.h>
13 #include <linux/videodev2.h> 13 #include <linux/videodev2.h>
14 #include <stdio.h> 14 #include <stdio.h>
15 #include <string.h> 15 #include <string.h>
16 #include <sys/ioctl.h> 16 #include <sys/ioctl.h>
17 #include <sys/mman.h> 17 #include <sys/mman.h>
18 #include <sys/stat.h> 18 #include <sys/stat.h>
19 #include <unistd.h> 19 #include <unistd.h>
20 20
21 #include <iostream> 21 #include <iostream>
22 #include <new> 22 #include <new>
23 23
24 #include "webrtc/base/refcount.h"
25 #include "webrtc/base/scoped_ref_ptr.h"
24 #include "webrtc/modules/video_capture/linux/video_capture_linux.h" 26 #include "webrtc/modules/video_capture/linux/video_capture_linux.h"
25 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 27 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
26 #include "webrtc/system_wrappers/include/ref_count.h"
27 #include "webrtc/system_wrappers/include/trace.h" 28 #include "webrtc/system_wrappers/include/trace.h"
28 29
29 namespace webrtc 30 namespace webrtc {
30 { 31 namespace videocapturemodule {
31 namespace videocapturemodule 32 rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
32 { 33 const int32_t id,
33 VideoCaptureModule* VideoCaptureImpl::Create(const int32_t id, 34 const char* deviceUniqueId) {
34 const char* deviceUniqueId) 35 rtc::scoped_refptr<VideoCaptureModuleV4L2> implementation(
35 { 36 new rtc::RefCountedObject<VideoCaptureModuleV4L2>(id));
36 RefCountImpl<videocapturemodule::VideoCaptureModuleV4L2>* implementation =
37 new RefCountImpl<videocapturemodule::VideoCaptureModuleV4L2>(id);
38 37
39 if (!implementation || implementation->Init(deviceUniqueId) != 0) 38 if (implementation->Init(deviceUniqueId) != 0)
40 { 39 return nullptr;
41 delete implementation;
42 implementation = NULL;
43 }
44 40
45 return implementation; 41 return implementation;
46 } 42 }
47 43
48 VideoCaptureModuleV4L2::VideoCaptureModuleV4L2(const int32_t id) 44 VideoCaptureModuleV4L2::VideoCaptureModuleV4L2(const int32_t id)
49 : VideoCaptureImpl(id), 45 : VideoCaptureImpl(id),
50 _captureCritSect(CriticalSectionWrapper::CreateCriticalSection()), 46 _captureCritSect(CriticalSectionWrapper::CreateCriticalSection()),
51 _deviceId(-1), 47 _deviceId(-1),
52 _deviceFd(-1), 48 _deviceFd(-1),
53 _buffersAllocatedByDevice(-1), 49 _buffersAllocatedByDevice(-1),
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 { 479 {
484 settings.width = _currentWidth; 480 settings.width = _currentWidth;
485 settings.height = _currentHeight; 481 settings.height = _currentHeight;
486 settings.maxFPS = _currentFrameRate; 482 settings.maxFPS = _currentFrameRate;
487 settings.rawType=_captureVideoType; 483 settings.rawType=_captureVideoType;
488 484
489 return 0; 485 return 0;
490 } 486 }
491 } // namespace videocapturemodule 487 } // namespace videocapturemodule
492 } // namespace webrtc 488 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_capture/linux/device_info_linux.cc ('k') | webrtc/modules/video_capture/mac/video_capture_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698