Index: webrtc/media/engine/webrtcvideocapturer.cc |
diff --git a/webrtc/media/engine/webrtcvideocapturer.cc b/webrtc/media/engine/webrtcvideocapturer.cc |
index a1848e933c82a6e0e2ca26865e839c4d06c6eeb0..e175688e169f833860059199d3c4541f9dd0c022 100644 |
--- a/webrtc/media/engine/webrtcvideocapturer.cc |
+++ b/webrtc/media/engine/webrtcvideocapturer.cc |
@@ -52,7 +52,9 @@ static kVideoFourCCEntry kSupportedFourCCs[] = { |
class WebRtcVcmFactory : public WebRtcVcmFactoryInterface { |
public: |
- virtual webrtc::VideoCaptureModule* Create(int id, const char* device) { |
+ virtual rtc::scoped_refptr<webrtc::VideoCaptureModule> Create( |
+ int id, |
+ const char* device) { |
return webrtc::VideoCaptureFactory::Create(id, device); |
} |
virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo(int id) { |
@@ -128,11 +130,7 @@ WebRtcVideoCapturer::WebRtcVideoCapturer(WebRtcVcmFactoryInterface* factory) |
set_frame_factory(new WebRtcVideoFrameFactory()); |
} |
-WebRtcVideoCapturer::~WebRtcVideoCapturer() { |
- if (module_) { |
- module_->Release(); |
- } |
-} |
+WebRtcVideoCapturer::~WebRtcVideoCapturer() {} |
bool WebRtcVideoCapturer::Init(const Device& device) { |
RTC_DCHECK(!start_thread_); |
@@ -198,14 +196,14 @@ bool WebRtcVideoCapturer::Init(const Device& device) { |
} |
// It is safe to change member attributes now. |
- module_->AddRef(); |
SetId(device.id); |
SetSupportedFormats(supported); |
return true; |
} |
-bool WebRtcVideoCapturer::Init(webrtc::VideoCaptureModule* module) { |
+bool WebRtcVideoCapturer::Init( |
+ const rtc::scoped_refptr<webrtc::VideoCaptureModule>& module) { |
RTC_DCHECK(!start_thread_); |
if (module_) { |
LOG(LS_ERROR) << "The capturer is already initialized"; |
@@ -216,7 +214,7 @@ bool WebRtcVideoCapturer::Init(webrtc::VideoCaptureModule* module) { |
return false; |
} |
// TODO(juberti): Set id and formats. |
- (module_ = module)->AddRef(); |
+ module_ = module; |
return true; |
} |