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

Unified Diff: webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm

Issue 2290583003: iOS: Add ability to specify audio constraints. (Closed)
Patch Set: Update ctor order. Created 4 years, 4 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/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm
index 0ac2ec4c8a881d47dc68efb34c087e573d8db4ad..d5fd1df06727697d1e97374d68f6a43738020f39 100644
--- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm
+++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm
@@ -12,7 +12,9 @@
#import "NSString+StdString.h"
#import "RTCAVFoundationVideoSource+Private.h"
+#import "RTCAudioSource+Private.h"
#import "RTCAudioTrack+Private.h"
+#import "RTCMediaConstraints+Private.h"
#import "RTCMediaStream+Private.h"
#import "RTCPeerConnection+Private.h"
#import "RTCVideoSource+Private.h"
@@ -61,17 +63,34 @@
_nativeFactory->StopAecDump();
}
-- (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints:
- (nullable RTCMediaConstraints *)constraints {
- return [[RTCAVFoundationVideoSource alloc] initWithFactory:self
- constraints:constraints];
+- (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints {
+ std::unique_ptr<webrtc::MediaConstraints> nativeConstraints;
+ if (constraints) {
+ nativeConstraints = constraints.nativeConstraints;
+ }
+ rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
+ _nativeFactory->CreateAudioSource(nativeConstraints.get());
+ return [[RTCAudioSource alloc] initWithNativeAudioSource:source];
}
- (RTCAudioTrack *)audioTrackWithTrackId:(NSString *)trackId {
+ RTCAudioSource *audioSource = [self audioSourceWithConstraints:nil];
+ return [self audioTrackWithSource:audioSource trackId:trackId];
+}
+
+- (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source
+ trackId:(NSString *)trackId {
return [[RTCAudioTrack alloc] initWithFactory:self
+ source:source
trackId:trackId];
}
+- (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints:
+ (nullable RTCMediaConstraints *)constraints {
+ return [[RTCAVFoundationVideoSource alloc] initWithFactory:self
+ constraints:constraints];
+}
+
- (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source
trackId:(NSString *)trackId {
return [[RTCVideoTrack alloc] initWithFactory:self
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/RTCMediaSource+Private.h ('k') | webrtc/sdk/objc/Framework/Classes/RTCVideoSource.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698