pRevert 5371 "Revert 5367 "Update talk to 59410372.""

> Revert 5367 "Update talk to 59410372."
> 
> > Update talk to 59410372.
> > 
> > R=jiayl@webrtc.org, wu@webrtc.org
> > 
> > Review URL: https://webrtc-codereview.appspot.com/6929004
> 
> TBR=mallinath@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/6999004

TBR=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/7109004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5381 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc
index e10e8fc..40640cf 100644
--- a/talk/app/webrtc/peerconnection.cc
+++ b/talk/app/webrtc/peerconnection.cc
@@ -32,6 +32,7 @@
 #include "talk/app/webrtc/dtmfsender.h"
 #include "talk/app/webrtc/jsepicecandidate.h"
 #include "talk/app/webrtc/jsepsessiondescription.h"
+#include "talk/app/webrtc/mediaconstraintsinterface.h"
 #include "talk/app/webrtc/mediastreamhandler.h"
 #include "talk/app/webrtc/streamcollection.h"
 #include "talk/base/logging.h"
@@ -359,11 +360,21 @@
   observer_ = observer;
   port_allocator_.reset(
       allocator_factory->CreatePortAllocator(stun_config, turn_config));
+
   // To handle both internal and externally created port allocator, we will
-  // enable BUNDLE here. Also enabling TURN and disable legacy relay service.
-  port_allocator_->set_flags(cricket::PORTALLOCATOR_ENABLE_BUNDLE |
-                             cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
-                             cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
+  // enable BUNDLE here.
+  int portallocator_flags = cricket::PORTALLOCATOR_ENABLE_BUNDLE |
+                            cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
+                            cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET;
+  bool value;
+  if (FindConstraint(
+        constraints,
+        MediaConstraintsInterface::kEnableIPv6,
+        &value, NULL) && value) {
+    portallocator_flags |= cricket::PORTALLOCATOR_ENABLE_IPV6;
+  }
+
+  port_allocator_->set_flags(portallocator_flags);
   // No step delay is used while allocating ports.
   port_allocator_->set_step_delay(cricket::kMinimumStepDelay);
 
@@ -485,8 +496,12 @@
 PeerConnection::CreateDataChannel(
     const std::string& label,
     const DataChannelInit* config) {
+  talk_base::scoped_ptr<InternalDataChannelInit> internal_config;
+  if (config) {
+    internal_config.reset(new InternalDataChannelInit(*config));
+  }
   talk_base::scoped_refptr<DataChannelInterface> channel(
-      session_->CreateDataChannel(label, config));
+      session_->CreateDataChannel(label, internal_config.get()));
   if (!channel.get())
     return NULL;