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

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: Rebased, no longer any proxy object changes. 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 | « webrtc/api/mediastreamprovider.h ('k') | webrtc/api/rtpsender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/objc/RTCAVFoundationVideoSource.mm
diff --git a/webrtc/api/objc/RTCAVFoundationVideoSource.mm b/webrtc/api/objc/RTCAVFoundationVideoSource.mm
index 1005c7dfa122c6528adc6b46cfb14644c430fc5f..94774f7039a2a9abfaf95d92ed62599deee65ef1 100644
--- a/webrtc/api/objc/RTCAVFoundationVideoSource.mm
+++ b/webrtc/api/objc/RTCAVFoundationVideoSource.mm
@@ -14,16 +14,21 @@
#import "webrtc/api/objc/RTCPeerConnectionFactory+Private.h"
#import "webrtc/api/objc/RTCVideoSource+Private.h"
-@implementation RTCAVFoundationVideoSource
+@implementation RTCAVFoundationVideoSource {
+ webrtc::AVFoundationVideoCapturer *_capturer;
+}
- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
constraints:(RTCMediaConstraints *)constraints {
NSParameterAssert(factory);
- rtc::scoped_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.nativeConstraints.get());
+ _capturer, constraints.nativeConstraints.get());
+
return [super initWithNativeVideoSource:source];
}
@@ -44,12 +49,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 _capturer;
}
@end
« no previous file with comments | « webrtc/api/mediastreamprovider.h ('k') | webrtc/api/rtpsender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698