Make SetLocalDescrption succeed with data-channel only offer and max-bundle policy.

This CL sets the data channel type of the session options before setting the bundle-enabled flag of the session options, so that bundle-enabled will be correctly set and the bundle group will be created.

BUG=webrtc:6218

Review-Url: https://codereview.webrtc.org/2473603002
Cr-Commit-Position: refs/heads/master@{#14904}
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
index 830c301..34beeff 100644
--- a/webrtc/api/peerconnection.cc
+++ b/webrtc/api/peerconnection.cc
@@ -1643,10 +1643,6 @@
         session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO) ||
         !remote_video_tracks_.empty();
   }
-  session_options->bundle_enabled =
-      session_options->bundle_enabled &&
-      (session_options->has_audio() || session_options->has_video() ||
-       session_options->has_data());
 
   // Intentionally unset the data channel type for RTP data channel with the
   // second condition. Otherwise the RTP data channels would be successfully
@@ -1657,6 +1653,11 @@
     session_options->data_channel_type = session_->data_channel_type();
   }
 
+  session_options->bundle_enabled =
+      session_options->bundle_enabled &&
+      (session_options->has_audio() || session_options->has_video() ||
+       session_options->has_data());
+
   session_options->rtcp_cname = rtcp_cname_;
   session_options->crypto_options = factory_->options().crypto_options;
   return true;
@@ -1682,11 +1683,6 @@
     }
   }
   AddSendStreams(session_options, senders_, rtp_data_channels_);
-  session_options->bundle_enabled =
-      session_options->bundle_enabled &&
-      (session_options->has_audio() || session_options->has_video() ||
-       session_options->has_data());
-
   // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams
   // are not signaled in the SDP so does not go through that path and must be
   // handled here.
@@ -1697,6 +1693,11 @@
   if (session_->data_channel_type() != cricket::DCT_RTP) {
     session_options->data_channel_type = session_->data_channel_type();
   }
+  session_options->bundle_enabled =
+      session_options->bundle_enabled &&
+      (session_options->has_audio() || session_options->has_video() ||
+       session_options->has_data());
+
   session_options->crypto_options = factory_->options().crypto_options;
 }