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

Unified Diff: webrtc/api/objc/RTCAVFoundationVideoSource.mm

Issue 1766653002: Replace SetCapturer and SetCaptureDevice by SetSource. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. 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
Index: webrtc/api/objc/RTCAVFoundationVideoSource.mm
diff --git a/webrtc/api/objc/RTCAVFoundationVideoSource.mm b/webrtc/api/objc/RTCAVFoundationVideoSource.mm
index 1005c7dfa122c6528adc6b46cfb14644c430fc5f..919190a4b9b321cfc28b8100a9cdc7174bd4e22d 100644
--- a/webrtc/api/objc/RTCAVFoundationVideoSource.mm
+++ b/webrtc/api/objc/RTCAVFoundationVideoSource.mm
@@ -19,11 +19,15 @@
- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
constraints:(RTCMediaConstraints *)constraints {
NSParameterAssert(factory);
- rtc::scoped_ptr<webrtc::AVFoundationVideoCapturer> capturer;
- capturer.reset(new webrtc::AVFoundationVideoCapturer());
+ webrtc::AVFoundationVideoCapturer *capturer =
+ new webrtc::AVFoundationVideoCapturer();
rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source =
factory.nativeFactory->CreateVideoSource(
- capturer.release(), constraints.nativeConstraints.get());
+ capturer, constraints.nativeConstraints.get());
+ // 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 = static_cast<void*>(capturer);
return [super initWithNativeVideoSource:source];
}
@@ -44,12 +48,7 @@
}
- (webrtc::AVFoundationVideoCapturer *)capturer {
- cricket::VideoCapturer *capturer = self.nativeVideoSource->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 static_cast<webrtc::AVFoundationVideoCapturer *>(_capturer);
}
@end

Powered by Google App Engine
This is Rietveld 408576698