Delete almost all use of MediaConstraintsInterface in the PeerConnection API

Bug: webrtc:9239
Change-Id: I04f4370f624346bf72c7e4e090b57987b558213b
Reviewed-on: https://webrtc-review.googlesource.com/74420
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24396}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 7271ece..28b3535 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -469,7 +469,6 @@
     deps = [
       ":array_view",
       ":libjingle_peerconnection_api",
-      ":libjingle_peerconnection_test_api",
       ":ortc_api",
       "../rtc_base:checks",
       "../rtc_base:rtc_base_approved",
diff --git a/api/mediaconstraintsinterface.cc b/api/mediaconstraintsinterface.cc
index fb4481f..c892606 100644
--- a/api/mediaconstraintsinterface.cc
+++ b/api/mediaconstraintsinterface.cc
@@ -260,4 +260,48 @@
   }
 }
 
+bool CopyConstraintsIntoOfferAnswerOptions(
+    const MediaConstraintsInterface* constraints,
+    PeerConnectionInterface::RTCOfferAnswerOptions* offer_answer_options) {
+  if (!constraints) {
+    return true;
+  }
+
+  bool value = false;
+  size_t mandatory_constraints_satisfied = 0;
+
+  if (FindConstraint(constraints,
+                     MediaConstraintsInterface::kOfferToReceiveAudio, &value,
+                     &mandatory_constraints_satisfied)) {
+    offer_answer_options->offer_to_receive_audio =
+        value ? PeerConnectionInterface::RTCOfferAnswerOptions::
+                    kOfferToReceiveMediaTrue
+              : 0;
+  }
+
+  if (FindConstraint(constraints,
+                     MediaConstraintsInterface::kOfferToReceiveVideo, &value,
+                     &mandatory_constraints_satisfied)) {
+    offer_answer_options->offer_to_receive_video =
+        value ? PeerConnectionInterface::RTCOfferAnswerOptions::
+                    kOfferToReceiveMediaTrue
+              : 0;
+  }
+  if (FindConstraint(constraints,
+                     MediaConstraintsInterface::kVoiceActivityDetection, &value,
+                     &mandatory_constraints_satisfied)) {
+    offer_answer_options->voice_activity_detection = value;
+  }
+  if (FindConstraint(constraints, MediaConstraintsInterface::kUseRtpMux, &value,
+                     &mandatory_constraints_satisfied)) {
+    offer_answer_options->use_rtp_mux = value;
+  }
+  if (FindConstraint(constraints, MediaConstraintsInterface::kIceRestart,
+                     &value, &mandatory_constraints_satisfied)) {
+    offer_answer_options->ice_restart = value;
+  }
+
+  return mandatory_constraints_satisfied == constraints->GetMandatory().size();
+}
+
 }  // namespace webrtc
diff --git a/api/mediaconstraintsinterface.h b/api/mediaconstraintsinterface.h
index 54ab706..3c85dfb 100644
--- a/api/mediaconstraintsinterface.h
+++ b/api/mediaconstraintsinterface.h
@@ -13,9 +13,10 @@
 // http://www.w3.org/TR/mediacapture-streams/#mediastreamconstraints and also
 // used in WebRTC: http://dev.w3.org/2011/webrtc/editor/webrtc.html#constraints.
 
-// This interface is being deprecated in Chrome, and may be removed
-// from WebRTC too.
-// https://bugs.chromium.org/p/webrtc/issues/detail?id=5617
+// Implementation of the w3c constraints spec is the responsibility of the
+// browser. Chrome no longer uses the constraints api declared here, and it will
+// be removed from WebRTC.
+// https://bugs.chromium.org/p/webrtc/issues/detail?id=9239
 
 #ifndef API_MEDIACONSTRAINTSINTERFACE_H_
 #define API_MEDIACONSTRAINTSINTERFACE_H_
@@ -144,6 +145,10 @@
     const MediaConstraintsInterface* constraints,
     cricket::AudioOptions* options);
 
+bool CopyConstraintsIntoOfferAnswerOptions(
+    const MediaConstraintsInterface* constraints,
+    PeerConnectionInterface::RTCOfferAnswerOptions* offer_answer_options);
+
 }  // namespace webrtc
 
 #endif  // API_MEDIACONSTRAINTSINTERFACE_H_
diff --git a/api/peerconnectionfactoryproxy.h b/api/peerconnectionfactoryproxy.h
index db52083..d885cc1 100644
--- a/api/peerconnectionfactoryproxy.h
+++ b/api/peerconnectionfactoryproxy.h
@@ -31,13 +31,6 @@
 // removed.
 using PeerConnectionFactoryInterface::CreateVideoSource;
 PROXY_METHOD1(void, SetOptions, const Options&)
-PROXY_METHOD5(rtc::scoped_refptr<PeerConnectionInterface>,
-              CreatePeerConnection,
-              const PeerConnectionInterface::RTCConfiguration&,
-              const MediaConstraintsInterface*,
-              std::unique_ptr<cricket::PortAllocator>,
-              std::unique_ptr<rtc::RTCCertificateGeneratorInterface>,
-              PeerConnectionObserver*);
 PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>,
               CreatePeerConnection,
               const PeerConnectionInterface::RTCConfiguration&,
diff --git a/api/peerconnectioninterface.cc b/api/peerconnectioninterface.cc
index ddaeb36..05aa53f 100644
--- a/api/peerconnectioninterface.cc
+++ b/api/peerconnectioninterface.cc
@@ -247,12 +247,4 @@
   return CreateVideoSource(std::unique_ptr<cricket::VideoCapturer>(capturer));
 }
 
-rtc::scoped_refptr<VideoTrackSourceInterface>
-PeerConnectionFactoryInterface::CreateVideoSource(
-    cricket::VideoCapturer* capturer,
-    const MediaConstraintsInterface* constraints) {
-  return CreateVideoSource(std::unique_ptr<cricket::VideoCapturer>(capturer),
-                           constraints);
-}
-
 }  // namespace webrtc
diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h
index 593084e..84a0501 100644
--- a/api/peerconnectioninterface.h
+++ b/api/peerconnectioninterface.h
@@ -846,22 +846,12 @@
   // Create a new offer.
   // The CreateSessionDescriptionObserver callback will be called when done.
   virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
-                           const MediaConstraintsInterface* constraints) {}
-
-  // TODO(jiayl): remove the default impl and the old interface when chromium
-  // code is updated.
-  virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
-                           const RTCOfferAnswerOptions& options) {}
+                           const RTCOfferAnswerOptions& options) = 0;
 
   // Create an answer to an offer.
   // The CreateSessionDescriptionObserver callback will be called when done.
   virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
-                            const RTCOfferAnswerOptions& options) {}
-  // Deprecated - use version above.
-  // TODO(hta): Remove and remove default implementations when all callers
-  // are updated.
-  virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
-                            const MediaConstraintsInterface* constraints) {}
+                            const RTCOfferAnswerOptions& options) = 0;
 
   // Sets the local session description.
   // The PeerConnection takes the ownership of |desc| even if it fails.
@@ -1293,10 +1283,6 @@
   // TODO(deadbeef): Remove these once safe to do so.
   virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
       cricket::VideoCapturer* capturer);
-  virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
-      cricket::VideoCapturer* capturer,
-      const MediaConstraintsInterface* constraints);
-
   // Creates a new local VideoTrack. The same |source| can be used in several
   // tracks.
   virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
diff --git a/api/peerconnectionproxy.h b/api/peerconnectionproxy.h
index 7fc5e17..6b66bcc 100644
--- a/api/peerconnectionproxy.h
+++ b/api/peerconnectionproxy.h
@@ -88,14 +88,6 @@
 PROXY_METHOD2(void,
               CreateOffer,
               CreateSessionDescriptionObserver*,
-              const MediaConstraintsInterface*)
-PROXY_METHOD2(void,
-              CreateAnswer,
-              CreateSessionDescriptionObserver*,
-              const MediaConstraintsInterface*)
-PROXY_METHOD2(void,
-              CreateOffer,
-              CreateSessionDescriptionObserver*,
               const RTCOfferAnswerOptions&)
 PROXY_METHOD2(void,
               CreateAnswer,
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 5a19a37..76526eb 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -721,7 +721,6 @@
 
     deps += [
       "../api:libjingle_peerconnection_api",
-      "../api:libjingle_peerconnection_test_api",
       "../api/audio_codecs:builtin_audio_decoder_factory",
       "../api/audio_codecs:builtin_audio_encoder_factory",
       "../api/video:video_frame",
@@ -853,7 +852,6 @@
     }
     deps = [
       "../api:libjingle_peerconnection_api",
-      "../api:libjingle_peerconnection_test_api",
       "../api/audio_codecs:builtin_audio_decoder_factory",
       "../api/audio_codecs:builtin_audio_encoder_factory",
       "../api/video:video_frame",
diff --git a/examples/peerconnection/client/conductor.cc b/examples/peerconnection/client/conductor.cc
index 89c8984..65d4aca 100644
--- a/examples/peerconnection/client/conductor.cc
+++ b/examples/peerconnection/client/conductor.cc
@@ -16,7 +16,6 @@
 
 #include "api/audio_codecs/builtin_audio_decoder_factory.h"
 #include "api/audio_codecs/builtin_audio_encoder_factory.h"
-#include "api/test/fakeconstraints.h"
 #include "api/video_codecs/builtin_video_decoder_factory.h"
 #include "api/video_codecs/builtin_video_encoder_factory.h"
 #include "examples/peerconnection/client/defaults.h"
diff --git a/examples/unityplugin/simple_peer_connection.cc b/examples/unityplugin/simple_peer_connection.cc
index df03e37..36e1937 100644
--- a/examples/unityplugin/simple_peer_connection.cc
+++ b/examples/unityplugin/simple_peer_connection.cc
@@ -15,7 +15,6 @@
 #include "absl/memory/memory.h"
 #include "api/audio_codecs/builtin_audio_decoder_factory.h"
 #include "api/audio_codecs/builtin_audio_encoder_factory.h"
-#include "api/test/fakeconstraints.h"
 #include "api/videosourceproxy.h"
 #include "media/engine/internaldecoderfactory.h"
 #include "media/engine/internalencoderfactory.h"
@@ -164,12 +163,11 @@
   webrtc::PeerConnectionInterface::IceServer stun_server;
   stun_server.uri = GetPeerConnectionString();
   config_.servers.push_back(stun_server);
-
-  webrtc::FakeConstraints constraints;
-  constraints.SetAllowDtlsSctpDataChannels();
+  config_.enable_rtp_data_channel = true;
+  config_.enable_dtls_srtp = false;
 
   peer_connection_ = g_peer_connection_factory->CreatePeerConnection(
-      config_, &constraints, nullptr, nullptr, this);
+      config_, nullptr, nullptr, this);
 
   return peer_connection_.get() != nullptr;
 }
@@ -207,12 +205,12 @@
   if (!peer_connection_.get())
     return false;
 
-  webrtc::FakeConstraints constraints;
+  webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options;
   if (mandatory_receive_) {
-    constraints.SetMandatoryReceiveAudio(true);
-    constraints.SetMandatoryReceiveVideo(true);
+    options.offer_to_receive_audio = true;
+    options.offer_to_receive_video = true;
   }
-  peer_connection_->CreateOffer(this, &constraints);
+  peer_connection_->CreateOffer(this, options);
   return true;
 }
 
@@ -220,12 +218,12 @@
   if (!peer_connection_.get())
     return false;
 
-  webrtc::FakeConstraints constraints;
+  webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options;
   if (mandatory_receive_) {
-    constraints.SetMandatoryReceiveAudio(true);
-    constraints.SetMandatoryReceiveVideo(true);
+    options.offer_to_receive_audio = true;
+    options.offer_to_receive_video = true;
   }
-  peer_connection_->CreateAnswer(this, &constraints);
+  peer_connection_->CreateAnswer(this, options);
   return true;
 }
 
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index 03b6d80..8e41ce0 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -338,7 +338,6 @@
     deps = [
       ":pc_test_utils",
       "../api:libjingle_peerconnection_api",
-      "../api:libjingle_peerconnection_test_api",
       "../api:rtc_stats_api",
       "../api/audio_codecs:builtin_audio_decoder_factory",
       "../api/audio_codecs:builtin_audio_encoder_factory",
diff --git a/pc/localaudiosource_unittest.cc b/pc/localaudiosource_unittest.cc
index 54766ca..fe3a0e2 100644
--- a/pc/localaudiosource_unittest.cc
+++ b/pc/localaudiosource_unittest.cc
@@ -13,14 +13,11 @@
 #include <string>
 #include <vector>
 
-#include "api/test/fakeconstraints.h"
 #include "media/base/fakemediaengine.h"
 #include "media/base/fakevideorenderer.h"
 #include "rtc_base/gunit.h"
 
 using webrtc::LocalAudioSource;
-using webrtc::MediaConstraintsInterface;
-using webrtc::MediaSourceInterface;
 
 TEST(LocalAudioSourceTest, InitWithAudioOptions) {
   cricket::AudioOptions audio_options;
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index e068f60..9155b71 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -773,50 +773,6 @@
   session_options->bundle_enabled = rtc_options.use_rtp_mux;
 }
 
-bool ConvertConstraintsToOfferAnswerOptions(
-    const MediaConstraintsInterface* constraints,
-    PeerConnectionInterface::RTCOfferAnswerOptions* offer_answer_options) {
-  if (!constraints) {
-    return true;
-  }
-
-  bool value = false;
-  size_t mandatory_constraints_satisfied = 0;
-
-  if (FindConstraint(constraints,
-                     MediaConstraintsInterface::kOfferToReceiveAudio, &value,
-                     &mandatory_constraints_satisfied)) {
-    offer_answer_options->offer_to_receive_audio =
-        value ? PeerConnectionInterface::RTCOfferAnswerOptions::
-                    kOfferToReceiveMediaTrue
-              : 0;
-  }
-
-  if (FindConstraint(constraints,
-                     MediaConstraintsInterface::kOfferToReceiveVideo, &value,
-                     &mandatory_constraints_satisfied)) {
-    offer_answer_options->offer_to_receive_video =
-        value ? PeerConnectionInterface::RTCOfferAnswerOptions::
-                    kOfferToReceiveMediaTrue
-              : 0;
-  }
-  if (FindConstraint(constraints,
-                     MediaConstraintsInterface::kVoiceActivityDetection, &value,
-                     &mandatory_constraints_satisfied)) {
-    offer_answer_options->voice_activity_detection = value;
-  }
-  if (FindConstraint(constraints, MediaConstraintsInterface::kUseRtpMux, &value,
-                     &mandatory_constraints_satisfied)) {
-    offer_answer_options->use_rtp_mux = value;
-  }
-  if (FindConstraint(constraints, MediaConstraintsInterface::kIceRestart,
-                     &value, &mandatory_constraints_satisfied)) {
-    offer_answer_options->ice_restart = value;
-  }
-
-  return mandatory_constraints_satisfied == constraints->GetMandatory().size();
-}
-
 PeerConnection::PeerConnection(PeerConnectionFactory* factory,
                                std::unique_ptr<RtcEventLog> event_log,
                                std::unique_ptr<Call> call)
@@ -1733,23 +1689,6 @@
 }
 
 void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
-                                 const MediaConstraintsInterface* constraints) {
-  TRACE_EVENT0("webrtc", "PeerConnection::CreateOffer");
-
-  PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options;
-  // Always create an offer even if |ConvertConstraintsToOfferAnswerOptions|
-  // returns false for now. Because |ConvertConstraintsToOfferAnswerOptions|
-  // compares the mandatory fields parsed with the mandatory fields added in the
-  // |constraints| and some downstream applications might create offers with
-  // mandatory fields which would not be parsed in the helper method. For
-  // example, in Chromium/remoting, |kEnableDtlsSrtp| is added to the
-  // |constraints| as a mandatory field but it is not parsed.
-  ConvertConstraintsToOfferAnswerOptions(constraints, &offer_answer_options);
-
-  CreateOffer(observer, offer_answer_options);
-}
-
-void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
                                  const RTCOfferAnswerOptions& options) {
   TRACE_EVENT0("webrtc", "PeerConnection::CreateOffer");
 
@@ -1861,29 +1800,6 @@
   return receiving_transceivers;
 }
 
-void PeerConnection::CreateAnswer(
-    CreateSessionDescriptionObserver* observer,
-    const MediaConstraintsInterface* constraints) {
-  TRACE_EVENT0("webrtc", "PeerConnection::CreateAnswer");
-
-  if (!observer) {
-    RTC_LOG(LS_ERROR) << "CreateAnswer - observer is NULL.";
-    return;
-  }
-
-  PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options;
-  if (!ConvertConstraintsToOfferAnswerOptions(constraints,
-                                              &offer_answer_options)) {
-    std::string error = "CreateAnswer called with invalid constraints.";
-    RTC_LOG(LS_ERROR) << error;
-    PostCreateSessionDescriptionFailure(
-        observer, RTCError(RTCErrorType::INVALID_PARAMETER, std::move(error)));
-    return;
-  }
-
-  CreateAnswer(observer, offer_answer_options);
-}
-
 void PeerConnection::CreateAnswer(CreateSessionDescriptionObserver* observer,
                                   const RTCOfferAnswerOptions& options) {
   TRACE_EVENT0("webrtc", "PeerConnection::CreateAnswer");
diff --git a/pc/peerconnection.h b/pc/peerconnection.h
index 25fbe1f..2942709 100644
--- a/pc/peerconnection.h
+++ b/pc/peerconnection.h
@@ -157,14 +157,8 @@
       const override;
 
   // JSEP01
-  // Deprecated, use version without constraints.
-  void CreateOffer(CreateSessionDescriptionObserver* observer,
-                   const MediaConstraintsInterface* constraints) override;
   void CreateOffer(CreateSessionDescriptionObserver* observer,
                    const RTCOfferAnswerOptions& options) override;
-  // Deprecated, use version without constraints.
-  void CreateAnswer(CreateSessionDescriptionObserver* observer,
-                    const MediaConstraintsInterface* constraints) override;
   void CreateAnswer(CreateSessionDescriptionObserver* observer,
                     const RTCOfferAnswerOptions& options) override;
   void SetLocalDescription(SetSessionDescriptionObserver* observer,
diff --git a/pc/peerconnection_crypto_unittest.cc b/pc/peerconnection_crypto_unittest.cc
index 5a8b5b8..1ccfe55 100644
--- a/pc/peerconnection_crypto_unittest.cc
+++ b/pc/peerconnection_crypto_unittest.cc
@@ -598,9 +598,11 @@
         new rtc::RefCountedObject<MockCreateSessionDescriptionObserver>();
     observers.push_back(observer);
     if (sdp_type_ == SdpType::kOffer) {
-      pc->pc()->CreateOffer(observer, nullptr);
+      pc->pc()->CreateOffer(observer,
+                            PeerConnectionInterface::RTCOfferAnswerOptions());
     } else {
-      pc->pc()->CreateAnswer(observer, nullptr);
+      pc->pc()->CreateAnswer(observer,
+                             PeerConnectionInterface::RTCOfferAnswerOptions());
     }
   }
   for (auto& observer : observers) {
diff --git a/pc/peerconnection_ice_unittest.cc b/pc/peerconnection_ice_unittest.cc
index 36e0a09..23a49e9 100644
--- a/pc/peerconnection_ice_unittest.cc
+++ b/pc/peerconnection_ice_unittest.cc
@@ -975,9 +975,9 @@
         new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
     port_allocator_ = port_allocator.get();
     rtc::scoped_refptr<PeerConnectionInterface> pc(
-        pc_factory_->CreatePeerConnection(
-            config, nullptr /* constraint */, std::move(port_allocator),
-            nullptr /* cert_generator */, &observer_));
+        pc_factory_->CreatePeerConnection(config, std::move(port_allocator),
+                                          nullptr /* cert_generator */,
+                                          &observer_));
     EXPECT_TRUE(pc.get());
     pc_ = std::move(pc.get());
   }
diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc
index 6def198..1b8054f 100644
--- a/pc/peerconnection_integrationtest.cc
+++ b/pc/peerconnection_integrationtest.cc
@@ -28,7 +28,6 @@
 #include "api/peerconnectioninterface.h"
 #include "api/peerconnectionproxy.h"
 #include "api/rtpreceiverinterface.h"
-#include "api/test/fakeconstraints.h"
 #include "api/video_codecs/builtin_video_decoder_factory.h"
 #include "api/video_codecs/builtin_video_encoder_factory.h"
 #include "api/video_codecs/sdp_video_format.h"
@@ -81,7 +80,6 @@
 using webrtc::DtmfSender;
 using webrtc::DtmfSenderInterface;
 using webrtc::DtmfSenderObserverInterface;
-using webrtc::FakeConstraints;
 using webrtc::FakeVideoTrackRenderer;
 using webrtc::MediaConstraintsInterface;
 using webrtc::MediaStreamInterface;
@@ -236,8 +234,8 @@
     PeerConnectionWrapper* client(new PeerConnectionWrapper(debug_name));
     webrtc::PeerConnectionDependencies dependencies(nullptr);
     dependencies.cert_generator = std::move(cert_generator);
-    if (!client->Init(nullptr, nullptr, nullptr, std::move(dependencies),
-                      network_thread, worker_thread, nullptr)) {
+    if (!client->Init(nullptr, nullptr, std::move(dependencies), network_thread,
+                      worker_thread, nullptr)) {
       delete client;
       return nullptr;
     }
@@ -561,8 +559,7 @@
   explicit PeerConnectionWrapper(const std::string& debug_name)
       : debug_name_(debug_name) {}
 
-  bool Init(const MediaConstraintsInterface* constraints,
-            const PeerConnectionFactory::Options* options,
+  bool Init(const PeerConnectionFactory::Options* options,
             const PeerConnectionInterface::RTCConfiguration* config,
             webrtc::PeerConnectionDependencies dependencies,
             rtc::Thread* network_thread,
@@ -619,13 +616,11 @@
     }
 
     dependencies.allocator = std::move(port_allocator);
-    peer_connection_ =
-        CreatePeerConnection(constraints, config, std::move(dependencies));
+    peer_connection_ = CreatePeerConnection(config, std::move(dependencies));
     return peer_connection_.get() != nullptr;
   }
 
   rtc::scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection(
-      const MediaConstraintsInterface* constraints,
       const PeerConnectionInterface::RTCConfiguration* config,
       webrtc::PeerConnectionDependencies dependencies) {
     PeerConnectionInterface::RTCConfiguration modified_config;
@@ -640,12 +635,6 @@
     // ratios and not specific resolutions, is this even necessary?
     modified_config.set_cpu_adaptation(false);
 
-    // Use the legacy interface.
-    if (constraints != nullptr) {
-      return peer_connection_factory_->CreatePeerConnection(
-          modified_config, constraints, std::move(dependencies.allocator),
-          std::move(dependencies.cert_generator), this);
-    }
     dependencies.observer = this;
     return peer_connection_factory_->CreatePeerConnection(
         modified_config, std::move(dependencies));
@@ -1154,7 +1143,6 @@
   // log factory will be used.
   std::unique_ptr<PeerConnectionWrapper> CreatePeerConnectionWrapper(
       const std::string& debug_name,
-      const MediaConstraintsInterface* constraints,
       const PeerConnectionFactory::Options* options,
       const RTCConfiguration* config,
       webrtc::PeerConnectionDependencies dependencies,
@@ -1171,9 +1159,9 @@
     std::unique_ptr<PeerConnectionWrapper> client(
         new PeerConnectionWrapper(debug_name));
 
-    if (!client->Init(constraints, options, &modified_config,
-                      std::move(dependencies), network_thread_.get(),
-                      worker_thread_.get(), std::move(event_log_factory))) {
+    if (!client->Init(options, &modified_config, std::move(dependencies),
+                      network_thread_.get(), worker_thread_.get(),
+                      std::move(event_log_factory))) {
       return nullptr;
     }
     return client;
@@ -1182,13 +1170,12 @@
   std::unique_ptr<PeerConnectionWrapper>
   CreatePeerConnectionWrapperWithFakeRtcEventLog(
       const std::string& debug_name,
-      const MediaConstraintsInterface* constraints,
       const PeerConnectionFactory::Options* options,
       const RTCConfiguration* config,
       webrtc::PeerConnectionDependencies dependencies) {
     std::unique_ptr<webrtc::FakeRtcEventLogFactory> event_log_factory(
         new webrtc::FakeRtcEventLogFactory(rtc::Thread::Current()));
-    return CreatePeerConnectionWrapper(debug_name, constraints, options, config,
+    return CreatePeerConnectionWrapper(debug_name, options, config,
                                        std::move(dependencies),
                                        std::move(event_log_factory));
   }
@@ -1210,37 +1197,24 @@
     SdpSemantics original_semantics = sdp_semantics_;
     sdp_semantics_ = caller_semantics;
     caller_ = CreatePeerConnectionWrapper(
-        "Caller", nullptr, nullptr, nullptr,
-        webrtc::PeerConnectionDependencies(nullptr), nullptr);
+        "Caller", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
+        nullptr);
     sdp_semantics_ = callee_semantics;
     callee_ = CreatePeerConnectionWrapper(
-        "Callee", nullptr, nullptr, nullptr,
-        webrtc::PeerConnectionDependencies(nullptr), nullptr);
+        "Callee", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
+        nullptr);
     sdp_semantics_ = original_semantics;
     return caller_ && callee_;
   }
 
-  bool CreatePeerConnectionWrappersWithConstraints(
-      MediaConstraintsInterface* caller_constraints,
-      MediaConstraintsInterface* callee_constraints) {
-    caller_ = CreatePeerConnectionWrapper(
-        "Caller", caller_constraints, nullptr, nullptr,
-        webrtc::PeerConnectionDependencies(nullptr), nullptr);
-    callee_ = CreatePeerConnectionWrapper(
-        "Callee", callee_constraints, nullptr, nullptr,
-        webrtc::PeerConnectionDependencies(nullptr), nullptr);
-
-    return caller_ && callee_;
-  }
-
   bool CreatePeerConnectionWrappersWithConfig(
       const PeerConnectionInterface::RTCConfiguration& caller_config,
       const PeerConnectionInterface::RTCConfiguration& callee_config) {
     caller_ = CreatePeerConnectionWrapper(
-        "Caller", nullptr, nullptr, &caller_config,
+        "Caller", nullptr, &caller_config,
         webrtc::PeerConnectionDependencies(nullptr), nullptr);
     callee_ = CreatePeerConnectionWrapper(
-        "Callee", nullptr, nullptr, &callee_config,
+        "Callee", nullptr, &callee_config,
         webrtc::PeerConnectionDependencies(nullptr), nullptr);
     return caller_ && callee_;
   }
@@ -1251,10 +1225,10 @@
       const PeerConnectionInterface::RTCConfiguration& callee_config,
       webrtc::PeerConnectionDependencies callee_dependencies) {
     caller_ =
-        CreatePeerConnectionWrapper("Caller", nullptr, nullptr, &caller_config,
+        CreatePeerConnectionWrapper("Caller", nullptr, &caller_config,
                                     std::move(caller_dependencies), nullptr);
     callee_ =
-        CreatePeerConnectionWrapper("Callee", nullptr, nullptr, &callee_config,
+        CreatePeerConnectionWrapper("Callee", nullptr, &callee_config,
                                     std::move(callee_dependencies), nullptr);
     return caller_ && callee_;
   }
@@ -1263,10 +1237,10 @@
       const PeerConnectionFactory::Options& caller_options,
       const PeerConnectionFactory::Options& callee_options) {
     caller_ = CreatePeerConnectionWrapper(
-        "Caller", nullptr, &caller_options, nullptr,
+        "Caller", &caller_options, nullptr,
         webrtc::PeerConnectionDependencies(nullptr), nullptr);
     callee_ = CreatePeerConnectionWrapper(
-        "Callee", nullptr, &callee_options, nullptr,
+        "Callee", &callee_options, nullptr,
         webrtc::PeerConnectionDependencies(nullptr), nullptr);
     return caller_ && callee_;
   }
@@ -1274,10 +1248,10 @@
   bool CreatePeerConnectionWrappersWithFakeRtcEventLog() {
     PeerConnectionInterface::RTCConfiguration default_config;
     caller_ = CreatePeerConnectionWrapperWithFakeRtcEventLog(
-        "Caller", nullptr, nullptr, &default_config,
+        "Caller", nullptr, &default_config,
         webrtc::PeerConnectionDependencies(nullptr));
     callee_ = CreatePeerConnectionWrapperWithFakeRtcEventLog(
-        "Callee", nullptr, nullptr, &default_config,
+        "Callee", nullptr, &default_config,
         webrtc::PeerConnectionDependencies(nullptr));
     return caller_ && callee_;
   }
@@ -1290,7 +1264,7 @@
 
     webrtc::PeerConnectionDependencies dependencies(nullptr);
     dependencies.cert_generator = std::move(cert_generator);
-    return CreatePeerConnectionWrapper("New Peer", nullptr, nullptr, nullptr,
+    return CreatePeerConnectionWrapper("New Peer", nullptr, nullptr,
                                        std::move(dependencies), nullptr);
   }
 
@@ -2906,10 +2880,10 @@
 // This test sets up a call between two parties with audio, video and an RTP
 // data channel.
 TEST_P(PeerConnectionIntegrationTest, EndToEndCallWithRtpDataChannel) {
-  FakeConstraints setup_constraints;
-  setup_constraints.SetAllowRtpDataChannels();
-  ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints,
-                                                          &setup_constraints));
+  PeerConnectionInterface::RTCConfiguration rtc_config;
+  rtc_config.enable_rtp_data_channel = true;
+  rtc_config.enable_dtls_srtp = false;
+  ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
   ConnectFakeSignaling();
   // Expect that data channel created on caller side will show up for callee as
   // well.
@@ -2942,10 +2916,10 @@
 TEST_P(PeerConnectionIntegrationTest,
        RtpDataChannelSignaledClosedInCalleeOffer) {
   // Same procedure as above test.
-  FakeConstraints setup_constraints;
-  setup_constraints.SetAllowRtpDataChannels();
-  ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints,
-                                                          &setup_constraints));
+  PeerConnectionInterface::RTCConfiguration rtc_config;
+  rtc_config.enable_rtp_data_channel = true;
+  rtc_config.enable_dtls_srtp = false;
+  ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
   ConnectFakeSignaling();
   caller()->CreateDataChannel();
   caller()->AddAudioVideoTracks();
@@ -2984,10 +2958,10 @@
   virtual_socket_server()->set_delay_mean(5);  // 5 ms per hop.
   virtual_socket_server()->UpdateDelayDistribution();
 
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  ASSERT_TRUE(
-      CreatePeerConnectionWrappersWithConstraints(&constraints, &constraints));
+  PeerConnectionInterface::RTCConfiguration rtc_config;
+  rtc_config.enable_rtp_data_channel = true;
+  rtc_config.enable_dtls_srtp = false;
+  ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
   ConnectFakeSignaling();
   caller()->CreateDataChannel();
   caller()->CreateAndSetAndSignalOffer();
@@ -3023,16 +2997,15 @@
 // This test sets up a call between two parties with audio, video and but only
 // the caller client supports RTP data channels.
 TEST_P(PeerConnectionIntegrationTest, RtpDataChannelsRejectedByCallee) {
-  FakeConstraints setup_constraints_1;
-  setup_constraints_1.SetAllowRtpDataChannels();
+  PeerConnectionInterface::RTCConfiguration rtc_config_1;
+  rtc_config_1.enable_rtp_data_channel = true;
   // Must disable DTLS to make negotiation succeed.
-  setup_constraints_1.SetMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
-                                   false);
-  FakeConstraints setup_constraints_2;
-  setup_constraints_2.SetMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
-                                   false);
-  ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(
-      &setup_constraints_1, &setup_constraints_2));
+  rtc_config_1.enable_dtls_srtp = false;
+  PeerConnectionInterface::RTCConfiguration rtc_config_2;
+  rtc_config_2.enable_dtls_srtp = false;
+  rtc_config_2.enable_dtls_srtp = false;
+  ASSERT_TRUE(
+      CreatePeerConnectionWrappersWithConfig(rtc_config_1, rtc_config_2));
   ConnectFakeSignaling();
   caller()->CreateDataChannel();
   caller()->AddAudioVideoTracks();
@@ -3049,10 +3022,10 @@
 // This test sets up a call between two parties with audio, and video. When
 // audio and video is setup and flowing, an RTP data channel is negotiated.
 TEST_P(PeerConnectionIntegrationTest, AddRtpDataChannelInSubsequentOffer) {
-  FakeConstraints setup_constraints;
-  setup_constraints.SetAllowRtpDataChannels();
-  ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints,
-                                                          &setup_constraints));
+  PeerConnectionInterface::RTCConfiguration rtc_config;
+  rtc_config.enable_rtp_data_channel = true;
+  rtc_config.enable_dtls_srtp = false;
+  ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
   ConnectFakeSignaling();
   // Do initial offer/answer with audio/video.
   caller()->AddAudioVideoTracks();
diff --git a/pc/peerconnection_rampup_tests.cc b/pc/peerconnection_rampup_tests.cc
index 6d6a9fc..850212b 100644
--- a/pc/peerconnection_rampup_tests.cc
+++ b/pc/peerconnection_rampup_tests.cc
@@ -11,7 +11,6 @@
 #include "api/audio_codecs/builtin_audio_decoder_factory.h"
 #include "api/audio_codecs/builtin_audio_encoder_factory.h"
 #include "api/stats/rtcstats_objects.h"
-#include "api/test/fakeconstraints.h"
 #include "api/video_codecs/builtin_video_decoder_factory.h"
 #include "api/video_codecs/builtin_video_encoder_factory.h"
 #include "p2p/base/testturnserver.h"
diff --git a/pc/peerconnectionendtoend_unittest.cc b/pc/peerconnectionendtoend_unittest.cc
index 7a8c2db..427529c 100644
--- a/pc/peerconnectionendtoend_unittest.cc
+++ b/pc/peerconnectionendtoend_unittest.cc
@@ -76,16 +76,13 @@
   }
 
   void CreatePcs(
-      const MediaConstraintsInterface* pc_constraints,
       rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory1,
       rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory1,
       rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory2,
       rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory2) {
-    EXPECT_TRUE(caller_->CreatePc(pc_constraints, config_,
-                                  audio_encoder_factory1,
+    EXPECT_TRUE(caller_->CreatePc(config_, audio_encoder_factory1,
                                   audio_decoder_factory1));
-    EXPECT_TRUE(callee_->CreatePc(pc_constraints, config_,
-                                  audio_encoder_factory2,
+    EXPECT_TRUE(callee_->CreatePc(config_, audio_encoder_factory2,
                                   audio_decoder_factory2));
     PeerConnectionTestWrapper::Connect(caller_.get(), callee_.get());
 
@@ -96,10 +93,9 @@
   }
 
   void CreatePcs(
-      const MediaConstraintsInterface* pc_constraints,
       rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
       rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) {
-    CreatePcs(pc_constraints, audio_encoder_factory, audio_decoder_factory,
+    CreatePcs(audio_encoder_factory, audio_decoder_factory,
               audio_encoder_factory, audio_decoder_factory);
   }
 
@@ -117,7 +113,10 @@
     callee_->GetAndAddUserMedia(audio, audio_options, video, video_constraints);
   }
 
-  void Negotiate() { caller_->CreateOffer(NULL); }
+  void Negotiate() {
+    caller_->CreateOffer(
+        webrtc::PeerConnectionInterface::RTCOfferAnswerOptions());
+  }
 
   void WaitForCallEstablished() {
     caller_->WaitForCallEstablished();
@@ -373,18 +372,16 @@
 TEST_P(PeerConnectionEndToEndTest, Call) {
   rtc::scoped_refptr<webrtc::AudioDecoderFactory> real_decoder_factory =
       webrtc::CreateBuiltinAudioDecoderFactory();
-  CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             CreateForwardingMockDecoderFactory(real_decoder_factory.get()));
   GetAndAddUserMedia();
   Negotiate();
   WaitForCallEstablished();
 }
 
-TEST_P(PeerConnectionEndToEndTest, CallWithLegacySdp) {
-  FakeConstraints pc_constraints;
-  pc_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
-                              false);
-  CreatePcs(&pc_constraints, webrtc::CreateBuiltinAudioEncoderFactory(),
+TEST_P(PeerConnectionEndToEndTest, CallWithSdesKeyNegotiation) {
+  config_.enable_dtls_srtp = false;
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             webrtc::CreateBuiltinAudioDecoderFactory());
   GetAndAddUserMedia();
   Negotiate();
@@ -446,8 +443,7 @@
 
   std::vector<webrtc::AudioCodecPairId> encoder_id1, encoder_id2, decoder_id1,
       decoder_id2;
-  CreatePcs(nullptr,
-            rtc::scoped_refptr<webrtc::AudioEncoderFactory>(
+  CreatePcs(rtc::scoped_refptr<webrtc::AudioEncoderFactory>(
                 new rtc::RefCountedObject<IdLoggingAudioEncoderFactory>(
                     webrtc::CreateAudioEncoderFactory<
                         AudioEncoderUnicornSparklesRainbow>(),
@@ -486,7 +482,7 @@
 // Verifies that a DataChannel created before the negotiation can transition to
 // "OPEN" and transfer data.
 TEST_P(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
-  CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
 
   webrtc::DataChannelInit init;
@@ -511,7 +507,7 @@
 // Verifies that a DataChannel created after the negotiation can transition to
 // "OPEN" and transfer data.
 TEST_P(PeerConnectionEndToEndTest, CreateDataChannelAfterNegotiate) {
-  CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
 
   webrtc::DataChannelInit init;
@@ -543,7 +539,7 @@
 
 // Verifies that a DataChannel created can transfer large messages.
 TEST_P(PeerConnectionEndToEndTest, CreateDataChannelLargeTransfer) {
-  CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
 
   webrtc::DataChannelInit init;
@@ -577,7 +573,7 @@
 
 // Verifies that DataChannel IDs are even/odd based on the DTLS roles.
 TEST_P(PeerConnectionEndToEndTest, DataChannelIdAssignment) {
-  CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
 
   webrtc::DataChannelInit init;
@@ -605,7 +601,7 @@
 // there are multiple DataChannels.
 TEST_P(PeerConnectionEndToEndTest,
        MessageTransferBetweenTwoPairsOfDataChannels) {
-  CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
 
   webrtc::DataChannelInit init;
@@ -645,7 +641,7 @@
 // channel, and the closed channel was incorrectly still assigned to the ID.
 TEST_P(PeerConnectionEndToEndTest,
        DataChannelFromOpenWorksAfterPreviousChannelClosed) {
-  CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
 
   webrtc::DataChannelInit init;
@@ -678,7 +674,7 @@
 // closing before creating the second one.
 TEST_P(PeerConnectionEndToEndTest,
        DataChannelFromOpenWorksWhilePreviousChannelClosing) {
-  CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
 
   webrtc::DataChannelInit init;
@@ -709,7 +705,7 @@
 // reference count), no memory access violation will occur.
 // See: https://code.google.com/p/chromium/issues/detail?id=565048
 TEST_P(PeerConnectionEndToEndTest, CloseDataChannelRemotelyWhileNotReferenced) {
-  CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
+  CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
             webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
 
   webrtc::DataChannelInit init;
diff --git a/pc/peerconnectionfactory.cc b/pc/peerconnectionfactory.cc
index d407228..b78ed8d 100644
--- a/pc/peerconnectionfactory.cc
+++ b/pc/peerconnectionfactory.cc
@@ -331,23 +331,6 @@
 
 rtc::scoped_refptr<PeerConnectionInterface>
 PeerConnectionFactory::CreatePeerConnection(
-    const PeerConnectionInterface::RTCConfiguration& configuration_in,
-    const MediaConstraintsInterface* constraints,
-    std::unique_ptr<cricket::PortAllocator> allocator,
-    std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
-    PeerConnectionObserver* observer) {
-  RTC_DCHECK(signaling_thread_->IsCurrent());
-
-  // We merge constraints and configuration into a single configuration.
-  PeerConnectionInterface::RTCConfiguration configuration = configuration_in;
-  CopyConstraintsIntoRtcConfiguration(constraints, &configuration);
-
-  return CreatePeerConnection(configuration, std::move(allocator),
-                              std::move(cert_generator), observer);
-}
-
-rtc::scoped_refptr<PeerConnectionInterface>
-PeerConnectionFactory::CreatePeerConnection(
     const PeerConnectionInterface::RTCConfiguration& configuration,
     std::unique_ptr<cricket::PortAllocator> allocator,
     std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
diff --git a/pc/peerconnectionfactory.h b/pc/peerconnectionfactory.h
index 82fa508..f36a4e0 100644
--- a/pc/peerconnectionfactory.h
+++ b/pc/peerconnectionfactory.h
@@ -42,14 +42,6 @@
 
   void SetOptions(const Options& options) override;
 
-  // Deprecated, use version without constraints.
-  rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
-      const PeerConnectionInterface::RTCConfiguration& configuration,
-      const MediaConstraintsInterface* constraints,
-      std::unique_ptr<cricket::PortAllocator> allocator,
-      std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
-      PeerConnectionObserver* observer) override;
-
   rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
       const PeerConnectionInterface::RTCConfiguration& configuration,
       std::unique_ptr<cricket::PortAllocator> allocator,
diff --git a/pc/peerconnectionfactory_unittest.cc b/pc/peerconnectionfactory_unittest.cc
index 773ba01..84c828f 100644
--- a/pc/peerconnectionfactory_unittest.cc
+++ b/pc/peerconnectionfactory_unittest.cc
@@ -178,7 +178,7 @@
   std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
       new FakeRTCCertificateGenerator());
   rtc::scoped_refptr<PeerConnectionInterface> pc(factory->CreatePeerConnection(
-      config, nullptr, nullptr, std::move(cert_generator), &observer));
+      config, nullptr, std::move(cert_generator), &observer));
 
   EXPECT_TRUE(pc.get() != nullptr);
 }
@@ -264,9 +264,9 @@
   config.servers.push_back(ice_server);
   std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
       new FakeRTCCertificateGenerator());
-  rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
-      config, nullptr, std::move(port_allocator_), std::move(cert_generator),
-      &observer_));
+  rtc::scoped_refptr<PeerConnectionInterface> pc(
+      factory_->CreatePeerConnection(config, std::move(port_allocator_),
+                                     std::move(cert_generator), &observer_));
   ASSERT_TRUE(pc.get() != NULL);
   cricket::ServerAddresses stun_servers;
   rtc::SocketAddress stun1("stun.l.google.com", 19302);
@@ -294,9 +294,9 @@
   config.servers.push_back(ice_server);
   std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
       new FakeRTCCertificateGenerator());
-  rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
-      config, nullptr, std::move(port_allocator_), std::move(cert_generator),
-      &observer_));
+  rtc::scoped_refptr<PeerConnectionInterface> pc(
+      factory_->CreatePeerConnection(config, std::move(port_allocator_),
+                                     std::move(cert_generator), &observer_));
   ASSERT_TRUE(pc.get() != NULL);
   cricket::ServerAddresses stun_servers;
   rtc::SocketAddress stun1("stun.l.google.com", 19302);
@@ -323,9 +323,9 @@
   config.servers.push_back(ice_server);
   std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
       new FakeRTCCertificateGenerator());
-  rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
-      config, nullptr, std::move(port_allocator_), std::move(cert_generator),
-      &observer_));
+  rtc::scoped_refptr<PeerConnectionInterface> pc(
+      factory_->CreatePeerConnection(config, std::move(port_allocator_),
+                                     std::move(cert_generator), &observer_));
   ASSERT_TRUE(pc.get() != NULL);
   std::vector<cricket::RelayServerConfig> turn_servers;
   cricket::RelayServerConfig turn("test.com", 1234, kTurnUsername,
@@ -344,9 +344,9 @@
   config.servers.push_back(ice_server);
   std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
       new FakeRTCCertificateGenerator());
-  rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
-      config, nullptr, std::move(port_allocator_), std::move(cert_generator),
-      &observer_));
+  rtc::scoped_refptr<PeerConnectionInterface> pc(
+      factory_->CreatePeerConnection(config, std::move(port_allocator_),
+                                     std::move(cert_generator), &observer_));
   ASSERT_TRUE(pc.get() != NULL);
   std::vector<cricket::RelayServerConfig> turn_servers;
   cricket::RelayServerConfig turn("hello.com", kDefaultStunPort, "test",
@@ -369,9 +369,9 @@
   config.servers.push_back(ice_server);
   std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
       new FakeRTCCertificateGenerator());
-  rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
-      config, nullptr, std::move(port_allocator_), std::move(cert_generator),
-      &observer_));
+  rtc::scoped_refptr<PeerConnectionInterface> pc(
+      factory_->CreatePeerConnection(config, std::move(port_allocator_),
+                                     std::move(cert_generator), &observer_));
   ASSERT_TRUE(pc.get() != NULL);
   std::vector<cricket::RelayServerConfig> turn_servers;
   cricket::RelayServerConfig turn1("hello.com", kDefaultStunTlsPort, "test",
@@ -404,9 +404,9 @@
   config.servers.push_back(ice_server);
   std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
       new FakeRTCCertificateGenerator());
-  rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
-      config, nullptr, std::move(port_allocator_), std::move(cert_generator),
-      &observer_));
+  rtc::scoped_refptr<PeerConnectionInterface> pc(
+      factory_->CreatePeerConnection(config, std::move(port_allocator_),
+                                     std::move(cert_generator), &observer_));
   ASSERT_TRUE(pc.get() != NULL);
   cricket::ServerAddresses stun_servers;
   rtc::SocketAddress stun1("1.2.3.4", 1234);
diff --git a/pc/peerconnectioninterface_unittest.cc b/pc/peerconnectioninterface_unittest.cc
index 1beb347..2f6c0ef 100644
--- a/pc/peerconnectioninterface_unittest.cc
+++ b/pc/peerconnectioninterface_unittest.cc
@@ -22,7 +22,6 @@
 #include "api/peerconnectioninterface.h"
 #include "api/rtpreceiverinterface.h"
 #include "api/rtpsenderinterface.h"
-#include "api/test/fakeconstraints.h"
 #include "api/video_codecs/builtin_video_decoder_factory.h"
 #include "api/video_codecs/builtin_video_encoder_factory.h"
 #include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
@@ -417,7 +416,6 @@
 using webrtc::AudioTrackInterface;
 using webrtc::DataBuffer;
 using webrtc::DataChannelInterface;
-using webrtc::FakeConstraints;
 using webrtc::IceCandidateInterface;
 using webrtc::MediaConstraintsInterface;
 using webrtc::MediaStream;
@@ -707,30 +705,23 @@
   }
 
   void CreatePeerConnection() {
-    CreatePeerConnection(PeerConnectionInterface::RTCConfiguration(), nullptr);
+    CreatePeerConnection(PeerConnectionInterface::RTCConfiguration());
   }
 
   // DTLS does not work in a loopback call, so is disabled for most of the
   // tests in this file.
   void CreatePeerConnectionWithoutDtls() {
-    FakeConstraints no_dtls_constraints;
-    no_dtls_constraints.AddMandatory(
-        webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false);
+    RTCConfiguration config;
+    config.enable_dtls_srtp = false;
 
-    CreatePeerConnection(PeerConnectionInterface::RTCConfiguration(),
-                         &no_dtls_constraints);
-  }
-
-  void CreatePeerConnection(webrtc::MediaConstraintsInterface* constraints) {
-    CreatePeerConnection(PeerConnectionInterface::RTCConfiguration(),
-                         constraints);
+    CreatePeerConnection(config);
   }
 
   void CreatePeerConnectionWithIceTransportsType(
       PeerConnectionInterface::IceTransportsType type) {
     PeerConnectionInterface::RTCConfiguration config;
     config.type = type;
-    return CreatePeerConnection(config, nullptr);
+    return CreatePeerConnection(config);
   }
 
   void CreatePeerConnectionWithIceServer(const std::string& uri,
@@ -740,12 +731,10 @@
     server.uri = uri;
     server.password = password;
     config.servers.push_back(server);
-    CreatePeerConnection(config, nullptr);
+    CreatePeerConnection(config);
   }
 
-  void CreatePeerConnection(
-      const PeerConnectionInterface::RTCConfiguration& config,
-      webrtc::MediaConstraintsInterface* constraints) {
+  void CreatePeerConnection(const RTCConfiguration& config) {
     std::unique_ptr<cricket::FakePortAllocator> port_allocator(
         new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
     port_allocator_ = port_allocator.get();
@@ -753,19 +742,16 @@
     // Create certificate generator unless DTLS constraint is explicitly set to
     // false.
     std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator;
-    bool dtls;
-    if (FindConstraint(constraints,
-                       webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                       &dtls, nullptr) &&
-        dtls) {
+
+    if (config.enable_dtls_srtp.value_or(true)) {
       fake_certificate_generator_ = new FakeRTCCertificateGenerator();
       cert_generator.reset(fake_certificate_generator_);
     }
     RTCConfiguration modified_config = config;
     modified_config.sdp_semantics = sdp_semantics_;
     pc_ = pc_factory_->CreatePeerConnection(
-        modified_config, constraints, std::move(port_allocator),
-        std::move(cert_generator), &observer_);
+        modified_config, std::move(port_allocator), std::move(cert_generator),
+        &observer_);
     ASSERT_TRUE(pc_.get() != NULL);
     observer_.SetPeerConnectionInterface(pc_.get());
     EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_);
@@ -778,8 +764,7 @@
     config.servers.push_back(server);
     config.sdp_semantics = sdp_semantics_;
     rtc::scoped_refptr<PeerConnectionInterface> pc =
-        pc_factory_->CreatePeerConnection(config, nullptr, nullptr, nullptr,
-                                          &observer_);
+        pc_factory_->CreatePeerConnection(config, nullptr, nullptr, &observer_);
     EXPECT_EQ(nullptr, pc);
   }
 
@@ -895,14 +880,14 @@
   }
 
   bool DoCreateOfferAnswer(std::unique_ptr<SessionDescriptionInterface>* desc,
-                           bool offer,
-                           MediaConstraintsInterface* constraints) {
+                           const RTCOfferAnswerOptions* options,
+                           bool offer) {
     rtc::scoped_refptr<MockCreateSessionDescriptionObserver> observer(
         new rtc::RefCountedObject<MockCreateSessionDescriptionObserver>());
     if (offer) {
-      pc_->CreateOffer(observer, constraints);
+      pc_->CreateOffer(observer, options ? *options : RTCOfferAnswerOptions());
     } else {
-      pc_->CreateAnswer(observer, constraints);
+      pc_->CreateAnswer(observer, options ? *options : RTCOfferAnswerOptions());
     }
     EXPECT_EQ_WAIT(true, observer->called(), kTimeout);
     *desc = observer->MoveDescription();
@@ -910,13 +895,13 @@
   }
 
   bool DoCreateOffer(std::unique_ptr<SessionDescriptionInterface>* desc,
-                     MediaConstraintsInterface* constraints) {
-    return DoCreateOfferAnswer(desc, true, constraints);
+                     const RTCOfferAnswerOptions* options) {
+    return DoCreateOfferAnswer(desc, options, true);
   }
 
   bool DoCreateAnswer(std::unique_ptr<SessionDescriptionInterface>* desc,
-                      MediaConstraintsInterface* constraints) {
-    return DoCreateOfferAnswer(desc, false, constraints);
+                      const RTCOfferAnswerOptions* options) {
+    return DoCreateOfferAnswer(desc, options, false);
   }
 
   bool DoSetSessionDescription(
@@ -1359,7 +1344,7 @@
   config.candidate_network_policy =
       PeerConnectionInterface::kCandidateNetworkPolicyLowCost;
   config.ice_candidate_pool_size = 1;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
 
   const cricket::FakePortAllocatorSession* session =
       static_cast<const cricket::FakePortAllocatorSession*>(
@@ -1411,8 +1396,8 @@
           webrtc::CreateBuiltinVideoDecoderFactory(), nullptr /* audio_mixer */,
           nullptr /* audio_processing */));
   rtc::scoped_refptr<PeerConnectionInterface> pc(
-      pc_factory->CreatePeerConnection(
-          config, nullptr, std::move(port_allocator), nullptr, &observer_));
+      pc_factory->CreatePeerConnection(config, std::move(port_allocator),
+                                       nullptr, &observer_));
 
   // Now validate that the config fields set above were applied to the
   // PortAllocator, as flags or otherwise.
@@ -1430,7 +1415,7 @@
 TEST_P(PeerConnectionInterfaceTest, GetConfigurationAfterCreatePeerConnection) {
   PeerConnectionInterface::RTCConfiguration config;
   config.type = PeerConnectionInterface::kRelay;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
 
   PeerConnectionInterface::RTCConfiguration returned_config =
       pc_->GetConfiguration();
@@ -1930,9 +1915,10 @@
 
 // This test setup two RTP data channels in loop back.
 TEST_P(PeerConnectionInterfaceTest, TestDataChannel) {
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_rtp_data_channel = true;
+  config.enable_dtls_srtp = false;
+  CreatePeerConnection(config);
   rtc::scoped_refptr<DataChannelInterface> data1 =
       pc_->CreateDataChannel("test1", NULL);
   rtc::scoped_refptr<DataChannelInterface> data2 =
@@ -1977,9 +1963,10 @@
 // This test verifies that sendnig binary data over RTP data channels should
 // fail.
 TEST_P(PeerConnectionInterfaceTest, TestSendBinaryOnRtpDataChannel) {
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_rtp_data_channel = true;
+  config.enable_dtls_srtp = false;
+  CreatePeerConnection(config);
   rtc::scoped_refptr<DataChannelInterface> data1 =
       pc_->CreateDataChannel("test1", NULL);
   rtc::scoped_refptr<DataChannelInterface> data2 =
@@ -2007,9 +1994,10 @@
 // This test setup a RTP data channels in loop back and test that a channel is
 // opened even if the remote end answer with a zero SSRC.
 TEST_P(PeerConnectionInterfaceTest, TestSendOnlyDataChannel) {
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_rtp_data_channel = true;
+  config.enable_dtls_srtp = false;
+  CreatePeerConnection(config);
   rtc::scoped_refptr<DataChannelInterface> data1 =
       pc_->CreateDataChannel("test1", NULL);
   std::unique_ptr<MockDataChannelObserver> observer1(
@@ -2029,9 +2017,11 @@
 // This test that if a data channel is added in an answer a receive only channel
 // channel is created.
 TEST_P(PeerConnectionInterfaceTest, TestReceiveOnlyDataChannel) {
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_rtp_data_channel = true;
+  config.enable_dtls_srtp = false;
+
+  CreatePeerConnection(config);
 
   std::string offer_label = "offer_channel";
   rtc::scoped_refptr<DataChannelInterface> offer_channel =
@@ -2069,9 +2059,9 @@
 // requested.
 // TODO(perkj): Remove this test once reliable channels are implemented.
 TEST_P(PeerConnectionInterfaceTest, CreateReliableRtpDataChannelShouldFail) {
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_rtp_data_channel = true;
+  CreatePeerConnection(rtc_config);
 
   std::string label = "test";
   webrtc::DataChannelInit config;
@@ -2083,9 +2073,9 @@
 
 // Verifies that duplicated label is not allowed for RTP data channel.
 TEST_P(PeerConnectionInterfaceTest, RtpDuplicatedLabelNotAllowed) {
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_rtp_data_channel = true;
+  CreatePeerConnection(config);
 
   std::string label = "test";
   rtc::scoped_refptr<DataChannelInterface> channel =
@@ -2100,9 +2090,9 @@
 // This tests that a SCTP data channel is returned using different
 // DataChannelInit configurations.
 TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannel) {
-  FakeConstraints constraints;
-  constraints.SetAllowDtlsSctpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_dtls_srtp = true;
+  CreatePeerConnection(rtc_config);
 
   webrtc::DataChannelInit config;
 
@@ -2138,9 +2128,9 @@
 // maxRetransmitTime are set for SCTP data channels.
 TEST_P(PeerConnectionInterfaceTest,
        CreateSctpDataChannelShouldFailForInvalidConfig) {
-  FakeConstraints constraints;
-  constraints.SetAllowDtlsSctpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_dtls_srtp = true;
+  CreatePeerConnection(rtc_config);
 
   std::string label = "test";
   webrtc::DataChannelInit config;
@@ -2156,9 +2146,9 @@
 // or out of range should fail.
 TEST_P(PeerConnectionInterfaceTest,
        CreateSctpDataChannelWithInvalidIdShouldFail) {
-  FakeConstraints constraints;
-  constraints.SetAllowDtlsSctpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_dtls_srtp = true;
+  CreatePeerConnection(rtc_config);
 
   webrtc::DataChannelInit config;
   rtc::scoped_refptr<DataChannelInterface> channel;
@@ -2183,10 +2173,9 @@
 
 // Verifies that duplicated label is allowed for SCTP data channel.
 TEST_P(PeerConnectionInterfaceTest, SctpDuplicatedLabelAllowed) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_dtls_srtp = true;
+  CreatePeerConnection(rtc_config);
 
   std::string label = "test";
   rtc::scoped_refptr<DataChannelInterface> channel =
@@ -2201,9 +2190,10 @@
 // This test verifies that OnRenegotiationNeeded is fired for every new RTP
 // DataChannel.
 TEST_P(PeerConnectionInterfaceTest, RenegotiationNeededForNewRtpDataChannel) {
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_rtp_data_channel = true;
+  rtc_config.enable_dtls_srtp = false;
+  CreatePeerConnection(rtc_config);
 
   rtc::scoped_refptr<DataChannelInterface> dc1 =
       pc_->CreateDataChannel("test1", NULL);
@@ -2217,9 +2207,10 @@
 
 // This test that a data channel closes when a PeerConnection is deleted/closed.
 TEST_P(PeerConnectionInterfaceTest, DataChannelCloseWhenPeerConnectionClose) {
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_rtp_data_channel = true;
+  rtc_config.enable_dtls_srtp = false;
+  CreatePeerConnection(rtc_config);
 
   rtc::scoped_refptr<DataChannelInterface> data1 =
       pc_->CreateDataChannel("test1", NULL);
@@ -2242,9 +2233,10 @@
 
 // This tests that RTP data channels can be rejected in an answer.
 TEST_P(PeerConnectionInterfaceTest, TestRejectRtpDataChannelInAnswer) {
-  FakeConstraints constraints;
-  constraints.SetAllowRtpDataChannels();
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_rtp_data_channel = true;
+  rtc_config.enable_dtls_srtp = false;
+  CreatePeerConnection(rtc_config);
 
   rtc::scoped_refptr<DataChannelInterface> offer_channel(
       pc_->CreateDataChannel("offer_channel", NULL));
@@ -2272,8 +2264,8 @@
 TEST_P(PeerConnectionInterfaceTest, DISABLED_TestRejectSctpDataChannelInAnswer)
 #endif
 {
-  FakeConstraints constraints;
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  CreatePeerConnection(rtc_config);
 
   rtc::scoped_refptr<DataChannelInterface> offer_channel(
       pc_->CreateDataChannel("offer_channel", NULL));
@@ -2298,10 +2290,9 @@
 // FireFox, use it as a remote session description, generate an answer and use
 // the answer as a local description.
 TEST_P(PeerConnectionInterfaceTest, ReceiveFireFoxOffer) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_dtls_srtp = true;
+  CreatePeerConnection(rtc_config);
   AddAudioTrack("audio_label");
   AddVideoTrack("video_label");
   std::unique_ptr<SessionDescriptionInterface> desc(
@@ -2333,10 +2324,9 @@
 // The fallback was previously supported but was removed to simplify the code
 // and because it's non-standard.
 TEST_P(PeerConnectionInterfaceTest, DtlsSdesFallbackNotSupported) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_dtls_srtp = true;
+  CreatePeerConnection(rtc_config);
   // Wait for fake certificate to be generated. Previously, this is what caused
   // the "a=crypto" lines to be rejected.
   AddAudioTrack("audio_label");
@@ -2378,10 +2368,9 @@
 // Test that if we're receiving (but not sending) a track, subsequent offers
 // will have m-lines with a=recvonly.
 TEST_P(PeerConnectionInterfaceTest, CreateSubsequentRecvOnlyOffer) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_dtls_srtp = true;
+  CreatePeerConnection(rtc_config);
   CreateAndSetRemoteOffer(GetSdpStringWithStream1());
   CreateAnswerAsLocalDescription();
 
@@ -2405,10 +2394,9 @@
 // offerToReceiveVideo/offerToReceiveAudio constraints are explicitly set to
 // false, the generated m-lines will be a=inactive.
 TEST_P(PeerConnectionInterfaceTest, CreateSubsequentInactiveOffer) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration rtc_config;
+  rtc_config.enable_dtls_srtp = true;
+  CreatePeerConnection(rtc_config);
   CreateAndSetRemoteOffer(GetSdpStringWithStream1());
   CreateAnswerAsLocalDescription();
 
@@ -2416,12 +2404,10 @@
   // A new offer would be recvonly, but we'll set the "no receive" constraints
   // to make it inactive.
   std::unique_ptr<SessionDescriptionInterface> offer;
-  FakeConstraints offer_constraints;
-  offer_constraints.AddMandatory(
-      webrtc::MediaConstraintsInterface::kOfferToReceiveVideo, false);
-  offer_constraints.AddMandatory(
-      webrtc::MediaConstraintsInterface::kOfferToReceiveAudio, false);
-  DoCreateOffer(&offer, &offer_constraints);
+  RTCOfferAnswerOptions options;
+  options.offer_to_receive_audio = 0;
+  options.offer_to_receive_video = 0;
+  DoCreateOffer(&offer, &options);
 
   const cricket::ContentInfo* video_content =
       cricket::GetFirstVideoContent(offer->description());
@@ -2461,7 +2447,7 @@
 TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesPruneTurnPortsFlag) {
   PeerConnectionInterface::RTCConfiguration config;
   config.prune_turn_ports = false;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
   config = pc_->GetConfiguration();
   EXPECT_FALSE(port_allocator_->prune_turn_ports());
 
@@ -2476,7 +2462,7 @@
 TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesIceCheckInterval) {
   PeerConnectionInterface::RTCConfiguration config;
   config.ice_check_min_interval = absl::nullopt;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
   config = pc_->GetConfiguration();
   config.ice_check_min_interval = 100;
   EXPECT_TRUE(pc_->SetConfiguration(config));
@@ -2573,7 +2559,7 @@
   config.bundle_policy = PeerConnectionInterface::kBundlePolicyBalanced;
   config.rtcp_mux_policy = PeerConnectionInterface::kRtcpMuxPolicyNegotiate;
   config.continual_gathering_policy = PeerConnectionInterface::GATHER_ONCE;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
 
   PeerConnectionInterface::RTCConfiguration modified_config =
       pc_->GetConfiguration();
@@ -2603,7 +2589,7 @@
 TEST_P(PeerConnectionInterfaceTest,
        SetConfigurationReturnsRangeErrorForBadCandidatePoolSize) {
   PeerConnectionInterface::RTCConfiguration config;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
   config = pc_->GetConfiguration();
 
   config.ice_candidate_pool_size = -1;
@@ -2622,7 +2608,7 @@
 TEST_P(PeerConnectionInterfaceTest,
        SetConfigurationReturnsSyntaxErrorFromBadIceUrls) {
   PeerConnectionInterface::RTCConfiguration config;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
   config = pc_->GetConfiguration();
 
   PeerConnectionInterface::IceServer bad_server;
@@ -2638,7 +2624,7 @@
 TEST_P(PeerConnectionInterfaceTest,
        SetConfigurationReturnsInvalidParameterIfCredentialsMissing) {
   PeerConnectionInterface::RTCConfiguration config;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
   config = pc_->GetConfiguration();
 
   PeerConnectionInterface::IceServer bad_server;
@@ -2753,10 +2739,9 @@
 // SDP string is created. In this test the two separate MediaStreams are
 // signaled.
 TEST_P(PeerConnectionInterfaceTest, UpdateRemoteStreams) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(GetSdpStringWithStream1());
 
   rtc::scoped_refptr<StreamCollection> reference(CreateStreamCollection(1, 1));
@@ -2780,10 +2765,9 @@
 // specific behavior.
 TEST_F(PeerConnectionInterfaceTestPlanB,
        AddRemoveTrackFromExistingRemoteMediaStream) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   std::unique_ptr<SessionDescriptionInterface> desc_ms1 =
       CreateSessionDescriptionAndReference(1, 1);
   EXPECT_TRUE(DoSetRemoteDescription(std::move(desc_ms1)));
@@ -2824,10 +2808,9 @@
 // This tests that remote tracks are ended if a local session description is set
 // that rejects the media content type.
 TEST_P(PeerConnectionInterfaceTest, RejectMediaContent) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   // First create and set a remote offer, then reject its video content in our
   // answer.
   CreateAndSetRemoteOffer(kSdpStringWithStream1PlanB);
@@ -2874,10 +2857,9 @@
 // of PeerConnection and then PeerConnection tries to reject the track.
 // Don't run under Unified Plan since the stream API is not available.
 TEST_F(PeerConnectionInterfaceTestPlanB, RemoveTrackThenRejectMediaContent) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(GetSdpStringWithStream1());
   MediaStreamInterface* remote_stream = observer_.remote_streams()->at(0);
   remote_stream->RemoveTrack(remote_stream->GetVideoTracks()[0]);
@@ -2901,10 +2883,9 @@
 // will be created, even if the description contains SSRCs/MSIDs.
 // See: https://code.google.com/p/webrtc/issues/detail?id=5054
 TEST_P(PeerConnectionInterfaceTest, RecvonlyDescriptionDoesntCreateStream) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
 
   std::string recvonly_offer = GetSdpStringWithStream1();
   rtc::replace_substrs(kSendrecv, strlen(kSendrecv), kRecvonly,
@@ -2920,10 +2901,9 @@
 // in a subsequent session description.
 // Don't run under Unified Plan since this behavior is Plan B specific.
 TEST_F(PeerConnectionInterfaceTestPlanB, SdpWithoutMsidCreatesDefaultStream) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(kSdpStringWithoutStreamsAudioOnly);
 
   ASSERT_EQ(1u, observer_.remote_streams()->count());
@@ -2950,10 +2930,9 @@
 // Don't run under Unified Plan since this behavior is Plan B specific.
 TEST_F(PeerConnectionInterfaceTestPlanB,
        SendOnlySdpWithoutMsidCreatesDefaultStream) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(kSdpStringSendOnlyWithoutStreams);
 
   ASSERT_EQ(1u, observer_.remote_streams()->count());
@@ -2968,10 +2947,9 @@
 // a remote track that as already been removed from the MediaStream.
 // Don't run under Unified Plan since this behavior is Plan B specific.
 TEST_F(PeerConnectionInterfaceTestPlanB, RemoveAlreadyGoneRemoteStream) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(GetSdpStringWithStream1());
   MediaStreamInterface* remote_stream = observer_.remote_streams()->at(0);
   remote_stream->RemoveTrack(remote_stream->GetAudioTracks()[0]);
@@ -2988,10 +2966,9 @@
 // Don't run under Unified Plan since this behavior is Plan B specific.
 TEST_F(PeerConnectionInterfaceTestPlanB,
        SdpWithoutMsidAndStreamsCreatesDefaultStream) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(kSdpStringWithoutStreams);
 
   ASSERT_EQ(1u, observer_.remote_streams()->count());
@@ -3004,10 +2981,9 @@
 // description doesn't contain any streams but does support MSID.
 // Don't run under Unified Plan since this behavior is Plan B specific.
 TEST_F(PeerConnectionInterfaceTestPlanB, SdpWithMsidDontCreatesDefaultStream) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(kSdpStringWithMsidWithoutStreams);
   EXPECT_EQ(0u, observer_.remote_streams()->count());
 }
@@ -3018,10 +2994,9 @@
 // Don't run under Unified Plan since this behavior is Plan B specific.
 TEST_F(PeerConnectionInterfaceTestPlanB,
        DefaultTracksNotDestroyedAndRecreated) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(kSdpStringWithoutStreamsAudioOnly);
 
   ASSERT_EQ(1u, observer_.remote_streams()->count());
@@ -3040,10 +3015,9 @@
 // description is updated to not have any MediaStreams.
 // Don't run under Unified Plan since this behavior is Plan B specific.
 TEST_F(PeerConnectionInterfaceTestPlanB, VerifyDefaultStreamIsNotCreated) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(GetSdpStringWithStream1());
   rtc::scoped_refptr<StreamCollection> reference(CreateStreamCollection(1, 1));
   EXPECT_TRUE(
@@ -3057,10 +3031,9 @@
 // an endpoint that doesn't signal SSRCs, but signals media stream IDs.
 TEST_F(PeerConnectionInterfaceTestPlanB,
        SdpWithMsidWithoutSsrcCreatesDefaultStream) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   std::string sdp_string = kSdpStringWithoutStreamsAudioOnly;
   // Add a=msid lines to simulate a Unified Plan endpoint that only
   // signals stream IDs with a=msid lines.
@@ -3081,10 +3054,9 @@
 // a=ssrc msid and a=msid lines for interop signaling with Plan B.
 TEST_F(PeerConnectionInterfaceTestPlanB,
        SdpWithEmptyMsidAndSsrcCreatesDefaultStreamId) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   // Add a a=msid line to the SDP. This is prioritized when parsing the SDP, so
   // the sender's stream ID will be interpreted as no stream IDs.
   std::string sdp_string = kSdpStringWithStream1AudioTrackOnly;
@@ -3120,10 +3092,9 @@
 // an RtpSender's lifetime isn't determined by when a local description is set.
 // Don't run under Unified Plan since this behavior is Plan B specific.
 TEST_F(PeerConnectionInterfaceTestPlanB, LocalDescriptionChanged) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
 
   // Create an offer with 1 stream with 2 tracks of each type.
   rtc::scoped_refptr<StreamCollection> stream_collection =
@@ -3160,10 +3131,9 @@
 // Don't run under Unified Plan since this behavior is Plan B specific.
 TEST_F(PeerConnectionInterfaceTestPlanB,
        AddLocalStreamAfterLocalDescriptionChanged) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
 
   rtc::scoped_refptr<StreamCollection> stream_collection =
       CreateStreamCollection(1, 2);
@@ -3190,10 +3160,9 @@
 // changed when SetLocalDescription is called.
 TEST_P(PeerConnectionInterfaceTest,
        ChangeSsrcOnTrackInLocalSessionDescription) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
 
   AddAudioTrack(kAudioTracks[0]);
   AddVideoTrack(kVideoTracks[0]);
@@ -3245,10 +3214,9 @@
 // Don't run under Unified Plan since the stream API is not available.
 TEST_F(PeerConnectionInterfaceTestPlanB,
        SignalSameTracksInSeparateMediaStream) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
 
   rtc::scoped_refptr<StreamCollection> stream_collection =
       CreateStreamCollection(2, 1);
@@ -3283,10 +3251,9 @@
 
 // This tests that PeerConnectionObserver::OnAddTrack is correctly called.
 TEST_P(PeerConnectionInterfaceTest, OnAddTrackCallback) {
-  FakeConstraints constraints;
-  constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
-                           true);
-  CreatePeerConnection(&constraints);
+  RTCConfiguration config;
+  config.enable_dtls_srtp = true;
+  CreatePeerConnection(config);
   CreateAndSetRemoteOffer(kSdpStringWithStream1AudioTrackOnly);
   EXPECT_EQ(observer_.num_added_tracks_, 1);
   EXPECT_EQ(observer_.last_added_track_label_, kAudioTracks[0]);
@@ -3302,9 +3269,7 @@
 TEST_P(PeerConnectionInterfaceTest, SetConfigurationCausingIceRestart) {
   PeerConnectionInterface::RTCConfiguration config;
   config.type = PeerConnectionInterface::kRelay;
-  // Need to pass default constraints to prevent disabling of DTLS...
-  FakeConstraints default_constraints;
-  CreatePeerConnection(config, &default_constraints);
+  CreatePeerConnection(config);
   config = pc_->GetConfiguration();
   AddAudioTrack(kAudioTracks[0], {kStreamId1});
   AddVideoTrack(kVideoTracks[0], {kStreamId1});
@@ -3338,9 +3303,7 @@
 TEST_P(PeerConnectionInterfaceTest, SetConfigurationNotCausingIceRestart) {
   PeerConnectionInterface::RTCConfiguration config;
   config.type = PeerConnectionInterface::kRelay;
-  // Need to pass default constraints to prevent disabling of DTLS...
-  FakeConstraints default_constraints;
-  CreatePeerConnection(config, &default_constraints);
+  CreatePeerConnection(config);
   config = pc_->GetConfiguration();
   AddAudioTrack(kAudioTracks[0]);
   AddVideoTrack(kVideoTracks[0]);
@@ -3374,9 +3337,7 @@
 TEST_P(PeerConnectionInterfaceTest, SetConfigurationCausingPartialIceRestart) {
   PeerConnectionInterface::RTCConfiguration config;
   config.type = PeerConnectionInterface::kRelay;
-  // Need to pass default constraints to prevent disabling of DTLS...
-  FakeConstraints default_constraints;
-  CreatePeerConnection(config, &default_constraints);
+  CreatePeerConnection(config);
   config = pc_->GetConfiguration();
   AddAudioTrack(kAudioTracks[0], {kStreamId1});
   AddVideoTrack(kVideoTracks[0], {kStreamId1});
@@ -3534,11 +3495,11 @@
   CreatePeerConnection();
 
   // First, create an offer with audio/video.
-  FakeConstraints constraints;
-  constraints.SetMandatoryReceiveAudio(true);
-  constraints.SetMandatoryReceiveVideo(true);
+  RTCOfferAnswerOptions options;
+  options.offer_to_receive_audio = 1;
+  options.offer_to_receive_video = 1;
   std::unique_ptr<SessionDescriptionInterface> offer;
-  ASSERT_TRUE(DoCreateOffer(&offer, &constraints));
+  ASSERT_TRUE(DoCreateOffer(&offer, &options));
   cricket::SessionDescription* desc = offer->description();
   ASSERT_EQ(2u, desc->transport_infos().size());
   EXPECT_TRUE(desc->transport_infos()[0].description.HasOption("trickle"));
@@ -3547,7 +3508,7 @@
   // Apply the offer as a remote description, then create an answer.
   EXPECT_TRUE(DoSetRemoteDescription(std::move(offer)));
   std::unique_ptr<SessionDescriptionInterface> answer;
-  ASSERT_TRUE(DoCreateAnswer(&answer, &constraints));
+  ASSERT_TRUE(DoCreateAnswer(&answer, &options));
   desc = answer->description();
   ASSERT_EQ(2u, desc->transport_infos().size());
   EXPECT_TRUE(desc->transport_infos()[0].description.HasOption("trickle"));
@@ -3559,7 +3520,7 @@
 TEST_P(PeerConnectionInterfaceTest, IceRenominationNotOffered) {
   PeerConnectionInterface::RTCConfiguration config;
   config.enable_ice_renomination = false;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
   AddAudioTrack("foo");
 
   std::unique_ptr<SessionDescriptionInterface> offer;
@@ -3575,7 +3536,7 @@
 TEST_P(PeerConnectionInterfaceTest, IceRenominationOptionInOfferAndAnswer) {
   PeerConnectionInterface::RTCConfiguration config;
   config.enable_ice_renomination = true;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
   AddAudioTrack("foo");
 
   std::unique_ptr<SessionDescriptionInterface> offer;
@@ -3602,11 +3563,11 @@
 TEST_P(PeerConnectionInterfaceTest, CreateOfferWithOfferToReceiveConstraints) {
   CreatePeerConnection();
 
-  FakeConstraints constraints;
-  constraints.SetMandatoryReceiveAudio(true);
-  constraints.SetMandatoryReceiveVideo(true);
+  RTCOfferAnswerOptions options;
+  options.offer_to_receive_audio = 1;
+  options.offer_to_receive_video = 1;
   std::unique_ptr<SessionDescriptionInterface> offer;
-  ASSERT_TRUE(DoCreateOffer(&offer, &constraints));
+  ASSERT_TRUE(DoCreateOffer(&offer, &options));
 
   cricket::SessionDescription* desc = offer->description();
   const cricket::ContentInfo* audio = cricket::GetFirstAudioContent(desc);
@@ -3627,18 +3588,18 @@
 
   // First, create an offer with audio/video and apply it as a remote
   // description.
-  FakeConstraints constraints;
-  constraints.SetMandatoryReceiveAudio(true);
-  constraints.SetMandatoryReceiveVideo(true);
+  RTCOfferAnswerOptions options;
+  options.offer_to_receive_audio = 1;
+  options.offer_to_receive_video = 1;
   std::unique_ptr<SessionDescriptionInterface> offer;
-  ASSERT_TRUE(DoCreateOffer(&offer, &constraints));
+  ASSERT_TRUE(DoCreateOffer(&offer, &options));
   EXPECT_TRUE(DoSetRemoteDescription(std::move(offer)));
 
   // Now create answer that rejects audio/video.
-  constraints.SetMandatoryReceiveAudio(false);
-  constraints.SetMandatoryReceiveVideo(false);
+  options.offer_to_receive_audio = 0;
+  options.offer_to_receive_video = 0;
   std::unique_ptr<SessionDescriptionInterface> answer;
-  ASSERT_TRUE(DoCreateAnswer(&answer, &constraints));
+  ASSERT_TRUE(DoCreateAnswer(&answer, &options));
 
   cricket::SessionDescription* desc = answer->description();
   const cricket::ContentInfo* audio = cricket::GetFirstAudioContent(desc);
@@ -3659,7 +3620,7 @@
 #endif  // HAVE_SCTP
   PeerConnectionInterface::RTCConfiguration config;
   config.bundle_policy = PeerConnectionInterface::kBundlePolicyMaxBundle;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
 
   // First, create an offer with only a data channel and apply it as a remote
   // description.
@@ -3745,7 +3706,7 @@
   config.ice_regather_interval_range.emplace(1000, 2000);
   config.continual_gathering_policy =
       PeerConnectionInterface::ContinualGatheringPolicy::GATHER_CONTINUALLY;
-  CreatePeerConnection(config, nullptr);
+  CreatePeerConnection(config);
 }
 
 // The current bitrate from BitrateSettings is currently clamped
@@ -3990,10 +3951,9 @@
     pcf_->Initialize();
   }
   const cricket::MediaConfig TestCreatePeerConnection(
-      const PeerConnectionInterface::RTCConfiguration& config,
-      const MediaConstraintsInterface* constraints) {
-    rtc::scoped_refptr<PeerConnectionInterface> pc(pcf_->CreatePeerConnection(
-        config, constraints, nullptr, nullptr, &observer_));
+      const RTCConfiguration& config) {
+    rtc::scoped_refptr<PeerConnectionInterface> pc(
+        pcf_->CreatePeerConnection(config, nullptr, nullptr, &observer_));
     EXPECT_TRUE(pc.get());
     return pc->GetConfiguration().media_config;
   }
@@ -4006,10 +3966,8 @@
 // default RTCConfiguration.
 TEST_F(PeerConnectionMediaConfigTest, TestDefaults) {
   PeerConnectionInterface::RTCConfiguration config;
-  FakeConstraints constraints;
 
-  const cricket::MediaConfig& media_config =
-      TestCreatePeerConnection(config, &constraints);
+  const cricket::MediaConfig& media_config = TestCreatePeerConnection(config);
 
   EXPECT_FALSE(media_config.enable_dscp);
   EXPECT_TRUE(media_config.video.enable_cpu_adaptation);
@@ -4018,42 +3976,13 @@
   EXPECT_FALSE(media_config.video.experiment_cpu_load_estimator);
 }
 
-// This test verifies the DSCP constraint is recognized and passed to
-// the PeerConnection.
-TEST_F(PeerConnectionMediaConfigTest, TestDscpConstraintTrue) {
-  PeerConnectionInterface::RTCConfiguration config;
-  FakeConstraints constraints;
-
-  constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDscp, true);
-  const cricket::MediaConfig& media_config =
-      TestCreatePeerConnection(config, &constraints);
-
-  EXPECT_TRUE(media_config.enable_dscp);
-}
-
-// This test verifies the cpu overuse detection constraint is
-// recognized and passed to the PeerConnection.
-TEST_F(PeerConnectionMediaConfigTest, TestCpuOveruseConstraintFalse) {
-  PeerConnectionInterface::RTCConfiguration config;
-  FakeConstraints constraints;
-
-  constraints.AddOptional(
-      webrtc::MediaConstraintsInterface::kCpuOveruseDetection, false);
-  const cricket::MediaConfig media_config =
-      TestCreatePeerConnection(config, &constraints);
-
-  EXPECT_FALSE(media_config.video.enable_cpu_adaptation);
-}
-
 // This test verifies that the enable_prerenderer_smoothing flag is
 // propagated from RTCConfiguration to the PeerConnection.
 TEST_F(PeerConnectionMediaConfigTest, TestDisablePrerendererSmoothingTrue) {
   PeerConnectionInterface::RTCConfiguration config;
-  FakeConstraints constraints;
 
   config.set_prerenderer_smoothing(false);
-  const cricket::MediaConfig& media_config =
-      TestCreatePeerConnection(config, &constraints);
+  const cricket::MediaConfig& media_config = TestCreatePeerConnection(config);
 
   EXPECT_FALSE(media_config.video.enable_prerenderer_smoothing);
 }
@@ -4062,31 +3991,13 @@
 // propagated from RTCConfiguration to the PeerConnection.
 TEST_F(PeerConnectionMediaConfigTest, TestEnableExperimentCpuLoadEstimator) {
   PeerConnectionInterface::RTCConfiguration config;
-  FakeConstraints constraints;
 
   config.set_experiment_cpu_load_estimator(true);
-  const cricket::MediaConfig& media_config =
-      TestCreatePeerConnection(config, &constraints);
+  const cricket::MediaConfig& media_config = TestCreatePeerConnection(config);
 
   EXPECT_TRUE(media_config.video.experiment_cpu_load_estimator);
 }
 
-// This test verifies the suspend below min bitrate constraint is
-// recognized and passed to the PeerConnection.
-TEST_F(PeerConnectionMediaConfigTest,
-       TestSuspendBelowMinBitrateConstraintTrue) {
-  PeerConnectionInterface::RTCConfiguration config;
-  FakeConstraints constraints;
-
-  constraints.AddOptional(
-      webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate,
-      true);
-  const cricket::MediaConfig media_config =
-      TestCreatePeerConnection(config, &constraints);
-
-  EXPECT_TRUE(media_config.video.suspend_below_min_bitrate);
-}
-
 // Tests a few random fields being different.
 TEST(RTCConfigurationTest, ComparisonOperators) {
   PeerConnectionInterface::RTCConfiguration a;
diff --git a/pc/rtcstats_integrationtest.cc b/pc/rtcstats_integrationtest.cc
index 355d1f7a8..987f49c 100644
--- a/pc/rtcstats_integrationtest.cc
+++ b/pc/rtcstats_integrationtest.cc
@@ -109,11 +109,9 @@
     PeerConnectionInterface::IceServer ice_server;
     ice_server.uri = "stun:1.1.1.1:3478";
     config.servers.push_back(ice_server);
-    EXPECT_TRUE(caller_->CreatePc(nullptr, config,
-                                  CreateBuiltinAudioEncoderFactory(),
+    EXPECT_TRUE(caller_->CreatePc(config, CreateBuiltinAudioEncoderFactory(),
                                   CreateBuiltinAudioDecoderFactory()));
-    EXPECT_TRUE(callee_->CreatePc(nullptr, config,
-                                  CreateBuiltinAudioEncoderFactory(),
+    EXPECT_TRUE(callee_->CreatePc(config, CreateBuiltinAudioEncoderFactory(),
                                   CreateBuiltinAudioDecoderFactory()));
     PeerConnectionTestWrapper::Connect(caller_.get(), callee_.get());
 
@@ -129,7 +127,7 @@
     callee_->CreateDataChannel("data", init);
 
     // Negotiate and wait for call to establish
-    caller_->CreateOffer(nullptr);
+    caller_->CreateOffer(PeerConnectionInterface::RTCOfferAnswerOptions());
     caller_->WaitForCallEstablished();
     callee_->WaitForCallEstablished();
   }
diff --git a/pc/test/fakepeerconnectionbase.h b/pc/test/fakepeerconnectionbase.h
index db8596c..93380c0 100644
--- a/pc/test/fakepeerconnectionbase.h
+++ b/pc/test/fakepeerconnectionbase.h
@@ -140,17 +140,11 @@
   }
 
   void CreateOffer(CreateSessionDescriptionObserver* observer,
-                   const MediaConstraintsInterface* constraints) override {}
-
-  void CreateOffer(CreateSessionDescriptionObserver* observer,
                    const RTCOfferAnswerOptions& options) override {}
 
   void CreateAnswer(CreateSessionDescriptionObserver* observer,
                     const RTCOfferAnswerOptions& options) override {}
 
-  void CreateAnswer(CreateSessionDescriptionObserver* observer,
-                    const MediaConstraintsInterface* constraints) override {}
-
   void SetLocalDescription(SetSessionDescriptionObserver* observer,
                            SessionDescriptionInterface* desc) override {}
 
diff --git a/pc/test/peerconnectiontestwrapper.cc b/pc/test/peerconnectiontestwrapper.cc
index 145a095..fc699d3 100644
--- a/pc/test/peerconnectiontestwrapper.cc
+++ b/pc/test/peerconnectiontestwrapper.cc
@@ -69,7 +69,6 @@
 PeerConnectionTestWrapper::~PeerConnectionTestWrapper() {}
 
 bool PeerConnectionTestWrapper::CreatePc(
-    const MediaConstraintsInterface* constraints,
     const webrtc::PeerConnectionInterface::RTCConfiguration& config,
     rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
     rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) {
@@ -95,8 +94,7 @@
   std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator(
       new FakeRTCCertificateGenerator());
   peer_connection_ = peer_connection_factory_->CreatePeerConnection(
-      config, constraints, std::move(port_allocator), std::move(cert_generator),
-      this);
+      config, std::move(port_allocator), std::move(cert_generator), this);
 
   return peer_connection_.get() != NULL;
 }
@@ -153,21 +151,21 @@
 }
 
 void PeerConnectionTestWrapper::CreateOffer(
-    const MediaConstraintsInterface* constraints) {
+    const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options) {
   RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ << ": CreateOffer.";
-  peer_connection_->CreateOffer(this, constraints);
+  peer_connection_->CreateOffer(this, options);
 }
 
 void PeerConnectionTestWrapper::CreateAnswer(
-    const MediaConstraintsInterface* constraints) {
+    const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options) {
   RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
                    << ": CreateAnswer.";
-  peer_connection_->CreateAnswer(this, constraints);
+  peer_connection_->CreateAnswer(this, options);
 }
 
 void PeerConnectionTestWrapper::ReceiveOfferSdp(const std::string& sdp) {
   SetRemoteDescription(SdpType::kOffer, sdp);
-  CreateAnswer(NULL);
+  CreateAnswer(webrtc::PeerConnectionInterface::RTCOfferAnswerOptions());
 }
 
 void PeerConnectionTestWrapper::ReceiveAnswerSdp(const std::string& sdp) {
diff --git a/pc/test/peerconnectiontestwrapper.h b/pc/test/peerconnectiontestwrapper.h
index f82bcf2..21ba89a 100644
--- a/pc/test/peerconnectiontestwrapper.h
+++ b/pc/test/peerconnectiontestwrapper.h
@@ -35,7 +35,6 @@
   virtual ~PeerConnectionTestWrapper();
 
   bool CreatePc(
-      const webrtc::MediaConstraintsInterface* constraints,
       const webrtc::PeerConnectionInterface::RTCConfiguration& config,
       rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
       rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory);
@@ -66,8 +65,10 @@
   void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
   void OnFailure(webrtc::RTCError) override {}
 
-  void CreateOffer(const webrtc::MediaConstraintsInterface* constraints);
-  void CreateAnswer(const webrtc::MediaConstraintsInterface* constraints);
+  void CreateOffer(
+      const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options);
+  void CreateAnswer(
+      const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options);
   void ReceiveOfferSdp(const std::string& sdp);
   void ReceiveAnswerSdp(const std::string& sdp);
   void AddIceCandidate(const std::string& sdp_mid,
diff --git a/sdk/android/src/jni/pc/peerconnection.cc b/sdk/android/src/jni/pc/peerconnection.cc
index 31a0689..79da797 100644
--- a/sdk/android/src/jni/pc/peerconnection.cc
+++ b/sdk/android/src/jni/pc/peerconnection.cc
@@ -451,7 +451,9 @@
   rtc::scoped_refptr<CreateSdpObserverJni> observer(
       new rtc::RefCountedObject<CreateSdpObserverJni>(jni, j_observer,
                                                       std::move(constraints)));
-  ExtractNativePC(jni, j_pc)->CreateOffer(observer, observer->constraints());
+  PeerConnectionInterface::RTCOfferAnswerOptions options;
+  CopyConstraintsIntoOfferAnswerOptions(observer->constraints(), &options);
+  ExtractNativePC(jni, j_pc)->CreateOffer(observer, options);
 }
 
 static void JNI_PeerConnection_CreateAnswer(
@@ -464,7 +466,9 @@
   rtc::scoped_refptr<CreateSdpObserverJni> observer(
       new rtc::RefCountedObject<CreateSdpObserverJni>(jni, j_observer,
                                                       std::move(constraints)));
-  ExtractNativePC(jni, j_pc)->CreateAnswer(observer, observer->constraints());
+  PeerConnectionInterface::RTCOfferAnswerOptions options;
+  CopyConstraintsIntoOfferAnswerOptions(observer->constraints(), &options);
+  ExtractNativePC(jni, j_pc)->CreateAnswer(observer, options);
 }
 
 static void JNI_PeerConnection_SetLocalDescription(
diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm
index d0bb39b..11c3a6d 100644
--- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm
+++ b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm
@@ -448,7 +448,10 @@
   rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserverAdapter>
       observer(new rtc::RefCountedObject
           <webrtc::CreateSessionDescriptionObserverAdapter>(completionHandler));
-  _peerConnection->CreateOffer(observer, constraints.nativeConstraints.get());
+  webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options;
+  CopyConstraintsIntoOfferAnswerOptions(constraints.nativeConstraints.get(), &options);
+
+  _peerConnection->CreateOffer(observer, options);
 }
 
 - (void)answerForConstraints:(RTCMediaConstraints *)constraints
@@ -458,7 +461,10 @@
   rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserverAdapter>
       observer(new rtc::RefCountedObject
           <webrtc::CreateSessionDescriptionObserverAdapter>(completionHandler));
-  _peerConnection->CreateAnswer(observer, constraints.nativeConstraints.get());
+  webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options;
+  CopyConstraintsIntoOfferAnswerOptions(constraints.nativeConstraints.get(), &options);
+
+  _peerConnection->CreateAnswer(observer, options);
 }
 
 - (void)setLocalDescription:(RTCSessionDescription *)sdp