Merge RTCConfiguration with RTCMediaConstraints in Java/Obj-C wrappers.
The intention of SetConfiguration is that it modifies the configuration,
while keeping the constraints passed into CreatePeerConnection. Right
now that's now happening. See bug for more explanation.
BUG=webrtc:6942
Review-Url: https://codereview.webrtc.org/2603653002
Cr-Commit-Position: refs/heads/master@{#15974}
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
index b4a8738..de7608c 100644
--- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
+++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
@@ -207,6 +207,7 @@
NSMutableArray<RTCMediaStream *> *_localStreams;
std::unique_ptr<webrtc::PeerConnectionDelegateAdapter> _observer;
rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection;
+ std::unique_ptr<webrtc::MediaConstraints> _nativeConstraints;
BOOL _hasStartedRtcEventLog;
}
@@ -224,11 +225,11 @@
}
if (self = [super init]) {
_observer.reset(new webrtc::PeerConnectionDelegateAdapter(self));
- std::unique_ptr<webrtc::MediaConstraints> nativeConstraints =
- constraints.nativeConstraints;
+ _nativeConstraints = constraints.nativeConstraints;
+ CopyConstraintsIntoRtcConfiguration(_nativeConstraints.get(),
+ config.get());
_peerConnection =
factory.nativeFactory->CreatePeerConnection(*config,
- nativeConstraints.get(),
nullptr,
nullptr,
_observer.get());
@@ -282,6 +283,8 @@
if (!config) {
return NO;
}
+ CopyConstraintsIntoRtcConfiguration(_nativeConstraints.get(),
+ config.get());
return _peerConnection->SetConfiguration(*config);
}