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

Unified Diff: talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm

Issue 1766653002: Replace SetCapturer and SetCaptureDevice by SetSource. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Move objc instance variables to the implementation file. Created 4 years, 8 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 | « no previous file | webrtc/api/mediastreaminterface.h » ('j') | webrtc/api/objc/RTCAVFoundationVideoSource.mm » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm
diff --git a/talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm b/talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm
index 660bb4d6cbfb28a4f65ed8366529c622b6618e11..f7e618daf00b2d6092f146724e4afce8fc4b1daa 100644
--- a/talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm
+++ b/talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm
@@ -34,15 +34,20 @@
#include <memory>
-@implementation RTCAVFoundationVideoSource
+@implementation RTCAVFoundationVideoSource {
+ webrtc::AVFoundationVideoCapturer* _capturer;
tkchin_webrtc 2016/04/06 19:41:46 nit: Capturer *_capturer; (the style in the file i
+}
- (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory
constraints:(RTCMediaConstraints*)constraints {
NSParameterAssert(factory);
- std::unique_ptr<webrtc::AVFoundationVideoCapturer> capturer;
- capturer.reset(new webrtc::AVFoundationVideoCapturer());
+ // We pass ownership of the capturer to the source, but since we own
+ // the source, it should be ok to keep a raw pointer to the
+ // capturer.
+ _capturer = new webrtc::AVFoundationVideoCapturer();
rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source =
- factory.nativeFactory->CreateVideoSource(capturer.release(), constraints.constraints);
+ factory.nativeFactory->CreateVideoSource(_capturer,
+ constraints.constraints);
return [super initWithMediaSource:source];
}
@@ -63,12 +68,7 @@
}
- (webrtc::AVFoundationVideoCapturer*)capturer {
- cricket::VideoCapturer* capturer = self.videoSource->GetVideoCapturer();
- // This should be safe because no one should have changed the underlying video
- // source.
- webrtc::AVFoundationVideoCapturer* foundationCapturer =
- static_cast<webrtc::AVFoundationVideoCapturer*>(capturer);
- return foundationCapturer;
+ return _capturer;
}
@end
« no previous file with comments | « no previous file | webrtc/api/mediastreaminterface.h » ('j') | webrtc/api/objc/RTCAVFoundationVideoSource.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698