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

Unified Diff: webrtc/media/engine/webrtcvideocapturer.cc

Issue 1817953005: Use rtc::scoped_refptr for WebRtcVideoCapturer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove incorrect early return 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvideocapturer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « webrtc/media/engine/webrtcvideocapturer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698