Bug 901560 - Datachannel no longer make second ICE component r=abr
authorEthan Hugg <ethanhugg@gmail.com>
Fri, 30 Aug 2013 12:51:05 -0700
changeset 176288 3bf339937af50cbd408135d4a05ae5c2013b8982
parent 176287 31c92e4b907f6c134513dc0750e055394cd31413
child 176289 52e299230d268bc0d733b9dc951b77ec4001ac68
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersabr
bugs901560
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 901560 - Datachannel no longer make second ICE component r=abr
media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
--- a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
@@ -841,17 +841,18 @@ int nr_ice_media_stream_disable_componen
 
     if (stream->ice_state != NR_ICE_MEDIA_STREAM_UNPAIRED)
       ABORT(R_FAILED);
 
     if ((r=nr_ice_media_stream_find_component(stream, component_id, &comp)))
       ABORT(r);
 
     /* Can only disable before pairing */
-    if (comp->state != NR_ICE_COMPONENT_UNPAIRED)
+    if (comp->state != NR_ICE_COMPONENT_UNPAIRED &&
+        comp->state != NR_ICE_COMPONENT_DISABLED)
       ABORT(R_FAILED);
 
     comp->state = NR_ICE_COMPONENT_DISABLED;
 
     _status=0;
  abort:
     return(_status);
   }
--- a/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
@@ -1,16 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include <errno.h>
-
 #include "cpr_in.h"
 #include "cpr_rand.h"
 #include "cpr_stdlib.h"
 #include "lsm.h"
 #include "fsm.h"
 #include "ccapi.h"
 #include "ccsip_sdp.h"
 #include "sdp.h"
@@ -98,48 +96,16 @@ gsmsdp_add_remote_track(uint16_t idx, ui
                          fsmdef_dcb_t *dcb_p, fsmdef_media_t *media);
 
 
 
 extern cc_media_cap_table_t g_media_table;
 
 extern boolean g_disable_mass_reg_debug_print;
 
-/*
- * gsmsdp_requires_two_dc_components
- *
- * returns TRUE if we are talking to Firefox and it's
- * a version that required two components for datachannel.
- */
-static boolean gsmsdp_requires_two_dc_components(void *sdp) {
-#define FIRST_VERSION_TO_USE_ONE_DC_COMPONENT 26
-    const char *owner_name = sdp_get_owner_username(sdp);
-    unsigned long remote_version;
-    char* strtoul_end;
-
-    if (strncmp(owner_name, SIPSDP_ORIGIN_APPNAME,
-        strlen(SIPSDP_ORIGIN_APPNAME)) == 0) {
-        /* This means we are talking to firefox, now read the major version */
-        errno = 0;
-        remote_version = strtoul(owner_name + strlen(SIPSDP_ORIGIN_APPNAME),
-            &strtoul_end, 10);
-        if (errno ||
-            strtoul_end == (owner_name + strlen(SIPSDP_ORIGIN_APPNAME)) ||
-            !remote_version) {
-            /* Unable to parse remote, must not be earlier firefox */
-            return FALSE;
-        }
-
-        return (remote_version < FIRST_VERSION_TO_USE_ONE_DC_COMPONENT) ?
-            TRUE : FALSE;
-    }
-
-    return FALSE;
-}
-
 /**
  * A wraper function to return the media capability supported by
  * the platform and session. This is a convient place if policy
  * to get the capability table as it applies to the session
  * updates the media_cap_tbl ptr in dcb
  *
  * @param[in]dcb     - pointer to the fsmdef_dcb_t
 
@@ -5726,16 +5692,23 @@ gsmsdp_create_local_sdp (fsmdef_dcb_t *d
             media_enabled = FALSE;
         }
 
         /*
          * Add each enabled media line to the SDP
          */
         if (media_enabled && ( media_cap->enabled || force_streams_enabled)) {
             level = level + 1;  /* next level */
+
+            /* Only audio and video use two ICE components */
+            if (media_cap->type != SDP_MEDIA_AUDIO &&
+                media_cap->type != SDP_MEDIA_VIDEO) {
+                vcmDisableRtcpComponent(dcb_p->peerconnection, level);
+            }
+
             ip_mode = platform_get_ip_address_mode();
             if (ip_mode >= CPR_IP_MODE_IPV6) {
                 if (gsmsdp_add_media_line(dcb_p, media_cap, cap_index,
                                           level, CPR_IP_ADDR_IPV6, offer)
                     == NULL) {
                     /* fail to add a media line, go back one level */
                     level = level - 1;
                 }
@@ -7014,29 +6987,16 @@ gsmsdp_install_peer_ice_attributes(fsm_f
         vcm_res = vcmDisableRtcpComponent(dcb_p->peerconnection,
           media->level);
 
         if (vcm_res) {
           return (CC_CAUSE_SETTING_ICE_SESSION_PARAMETERS_FAILED);
         }
       }
 
-      /* If this is Datachannel and we are talking to anything other
-         than an older version of Firefox then disable the second component
-         of the ICE stream */
-      if (media->type == DATA &&
-          !gsmsdp_requires_two_dc_components(sdp_p->dest_sdp)) {
-        vcm_res = vcmDisableRtcpComponent(dcb_p->peerconnection,
-          media->level);
-
-        if (vcm_res) {
-          return CC_CAUSE_SETTING_ICE_SESSION_PARAMETERS_FAILED;
-        }
-      }
-
       sdp_res = sdp_attr_get_ice_attribute(sdp_p->dest_sdp, media->level, 0,
         SDP_ATTR_ICE_UFRAG, 1, &ufrag);
       if (sdp_res != SDP_SUCCESS)
         ufrag = NULL;
 
       sdp_res = sdp_attr_get_ice_attribute(sdp_p->dest_sdp, media->level, 0,
         SDP_ATTR_ICE_PWD, 1, &pwd);
       if (sdp_res != SDP_SUCCESS)