Update stable to r4882.

git-svn-id: http://webrtc.googlecode.com/svn/stable/talk@4883 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/app/webrtc/mediaconstraintsinterface.h b/app/webrtc/mediaconstraintsinterface.h
index bc3872c..48022dd 100644
--- a/app/webrtc/mediaconstraintsinterface.h
+++ b/app/webrtc/mediaconstraintsinterface.h
@@ -112,10 +112,13 @@
   // stripped by Chrome before passed down to Libjingle.
   static const char kInternalConstraintPrefix[];
 
-  // This constraint is for internal use only, representing the Chrome command
-  // line flag. So it is prefixed with "internal" so JS values will be removed.
+  // These constraints are for internal use only, representing Chrome command
+  // line flags. So they are prefixed with "internal" so JS values will be
+  // removed.
   // Used by a local audio source.
   static const char kInternalAecDump[];  // internalAecDump
+  // Used for disabling security and use plain RTP.
+  static const char kInternalDisableEncryption[];  // internalDisableEncryption
 
  protected:
   // Dtor protected as objects shouldn't be deleted via this interface
diff --git a/app/webrtc/webrtcsession.cc b/app/webrtc/webrtcsession.cc
index 83f8912..ff331a9 100644
--- a/app/webrtc/webrtcsession.cc
+++ b/app/webrtc/webrtcsession.cc
@@ -69,6 +69,9 @@
 const char MediaConstraintsInterface::kEnableSctpDataChannels[] =
     "internalSctpDataChannels";
 
+const char MediaConstraintsInterface::kInternalDisableEncryption[] =
+    "internalDisableEncryption";
+
 // Error messages
 const char kSetLocalSdpFailed[] = "SetLocalDescription failed: ";
 const char kSetRemoteSdpFailed[] = "SetRemoteDescription failed: ";
@@ -488,6 +491,15 @@
 
   webrtc_session_desc_factory_->SignalIdentityReady.connect(
       this, &WebRtcSession::OnIdentityReady);
+
+  // Disable encryption if kDisableEncryption is set.
+  if (FindConstraint(
+         constraints,
+         MediaConstraintsInterface::kInternalDisableEncryption,
+         &value, NULL) && value) {
+    webrtc_session_desc_factory_->set_secure(cricket::SEC_DISABLED);
+  }
+
   return true;
 }
 
diff --git a/app/webrtc/webrtcsession_unittest.cc b/app/webrtc/webrtcsession_unittest.cc
index acbc924..c47fb17 100644
--- a/app/webrtc/webrtcsession_unittest.cc
+++ b/app/webrtc/webrtcsession_unittest.cc
@@ -1877,8 +1877,10 @@
 }
 
 TEST_F(WebRtcSessionTest, VerifyNoCryptoParamsInSDP) {
+  constraints_.reset(new FakeConstraints());
+  constraints_->AddOptional(
+      webrtc::MediaConstraintsInterface::kInternalDisableEncryption, true);
   Init(NULL);
-  session_->set_secure_policy(cricket::SEC_DISABLED);
   mediastream_signaling_.SendAudioVideoStream1();
   scoped_ptr<SessionDescriptionInterface> offer(
         CreateOffer(NULL));
@@ -2342,9 +2344,11 @@
 
 // This test verifies the crypto parameter when security is disabled.
 TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescriptionWithDisabled) {
+  constraints_.reset(new FakeConstraints());
+  constraints_->AddOptional(
+      webrtc::MediaConstraintsInterface::kInternalDisableEncryption, true);
   Init(NULL);
   mediastream_signaling_.SendAudioVideoStream1();
-  session_->set_secure_policy(cricket::SEC_DISABLED);
   talk_base::scoped_ptr<SessionDescriptionInterface> offer(
       CreateOffer(NULL));
 
diff --git a/base/natsocketfactory.cc b/base/natsocketfactory.cc
index a7c4240..1686f20 100644
--- a/base/natsocketfactory.cc
+++ b/base/natsocketfactory.cc
@@ -85,7 +85,7 @@
 class NATSocket : public AsyncSocket, public sigslot::has_slots<> {
  public:
   explicit NATSocket(NATInternalSocketFactory* sf, int family, int type)
-      : sf_(sf), family_(family), type_(type), async_(true), connected_(false),
+      : sf_(sf), family_(family), type_(type), connected_(false),
         socket_(NULL), buf_(NULL), size_(0) {
   }
 
@@ -312,7 +312,6 @@
   NATInternalSocketFactory* sf_;
   int family_;
   int type_;
-  bool async_;
   bool connected_;
   SocketAddress remote_addr_;
   SocketAddress server_addr_;  // address of the NAT server
diff --git a/base/openssladapter.cc b/base/openssladapter.cc
index 50391e5..8e33a03 100644
--- a/base/openssladapter.cc
+++ b/base/openssladapter.cc
@@ -233,7 +233,10 @@
 bool OpenSSLAdapter::InitializeSSL(VerificationCallback callback) {
   if (!InitializeSSLThread() || !SSL_library_init())
       return false;
+#if !defined(ADDRESS_SANITIZER) || !defined(OSX)
+  // Loading the error strings crashed mac_asan. Omit this debugging aid there.
   SSL_load_error_strings();
+#endif
   ERR_load_BIO_strings();
   OpenSSL_add_all_algorithms();
   RAND_poll();
diff --git a/media/base/rtpdataengine_unittest.cc b/media/base/rtpdataengine_unittest.cc
index 37ea968..bc46818 100644
--- a/media/base/rtpdataengine_unittest.cc
+++ b/media/base/rtpdataengine_unittest.cc
@@ -299,8 +299,7 @@
   EXPECT_EQ(header0.timestamp + 180000, header1.timestamp);
 }
 
-// See: https://code.google.com/p/webrtc/issues/detail?id=2409
-TEST_F(RtpDataMediaChannelTest, DISABLED_SendDataMultipleClocks) {
+TEST_F(RtpDataMediaChannelTest, SendDataMultipleClocks) {
   // Timings owned by RtpDataEngines.
   FakeTiming* timing1 = new FakeTiming();
   talk_base::scoped_ptr<cricket::RtpDataEngine> dme1(CreateEngine(timing1));
diff --git a/media/webrtc/webrtcmediaengine.h b/media/webrtc/webrtcmediaengine.h
index a2ee658..5690ca0 100644
--- a/media/webrtc/webrtcmediaengine.h
+++ b/media/webrtc/webrtcmediaengine.h
@@ -87,10 +87,13 @@
   virtual SoundclipMedia* CreateSoundclip() OVERRIDE {
     return delegate_->CreateSoundclip();
   }
-  virtual bool SetAudioOptions(int options) OVERRIDE {
+  virtual AudioOptions GetAudioOptions() const OVERRIDE {
+    return delegate_->GetAudioOptions();
+  }
+  virtual bool SetAudioOptions(const AudioOptions& options) OVERRIDE {
     return delegate_->SetAudioOptions(options);
   }
-  virtual bool SetVideoOptions(int options) OVERRIDE {
+  virtual bool SetVideoOptions(const VideoOptions& options) OVERRIDE {
     return delegate_->SetVideoOptions(options);
   }
   virtual bool SetAudioDelayOffset(int offset) OVERRIDE {