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 |