dont allocate a payload type for rtp data channels when using sctp

BUG=webrtc:12194,webrtc:6625

Change-Id: Ifc8f0b197a536626c16ba5c3ebccbf242008c857
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193861
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#32651}
diff --git a/pc/media_session.cc b/pc/media_session.cc
index 6d8a9a4..4fd3efa 100644
--- a/pc/media_session.cc
+++ b/pc/media_session.cc
@@ -1512,8 +1512,11 @@
   AudioCodecs offer_audio_codecs;
   VideoCodecs offer_video_codecs;
   RtpDataCodecs offer_rtp_data_codecs;
-  GetCodecsForOffer(current_active_contents, &offer_audio_codecs,
-                    &offer_video_codecs, &offer_rtp_data_codecs);
+  GetCodecsForOffer(
+      current_active_contents, &offer_audio_codecs, &offer_video_codecs,
+      session_options.data_channel_type == DataChannelType::DCT_SCTP
+          ? nullptr
+          : &offer_rtp_data_codecs);
   if (!session_options.vad_enabled) {
     // If application doesn't want CN codecs in offer.
     StripCNCodecs(&offer_audio_codecs);
@@ -1930,7 +1933,10 @@
   // Add our codecs that are not in the current description.
   MergeCodecs<AudioCodec>(all_audio_codecs_, audio_codecs, &used_pltypes);
   MergeCodecs<VideoCodec>(all_video_codecs_, video_codecs, &used_pltypes);
-  MergeCodecs<DataCodec>(rtp_data_codecs_, rtp_data_codecs, &used_pltypes);
+  // Only allocate a payload type for rtp datachannels when using rtp data
+  // channels.
+  if (rtp_data_codecs)
+    MergeCodecs<DataCodec>(rtp_data_codecs_, rtp_data_codecs, &used_pltypes);
 }
 
 // Getting codecs for an answer involves these steps: