Bug 1073750 - parse sctp port in m line only once. r=ethanhugg
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Fri, 26 Sep 2014 17:33:00 +0200
changeset 232135 8c673a309278b67dc0cc97d5e15720ff360d8ea7
parent 232134 094128a6d5a6aa4ebb128d5fbc013344986d567c
child 232136 264cf0a35e48aa02936aca5dac807970bdb0f905
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersethanhugg
bugs1073750
milestone35.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 1073750 - parse sctp port in m line only once. r=ethanhugg
media/webrtc/signaling/src/sipcc/core/sdp/sdp_token.c
--- a/media/webrtc/signaling/src/sipcc/core/sdp/sdp_token.c
+++ b/media/webrtc/signaling/src/sipcc/core/sdp/sdp_token.c
@@ -1370,49 +1370,49 @@ sdp_result_e sdp_parse_media (sdp_t *sdp
      * transport/profile types per line, so these are handled differently. */
     if ((mca_p->transport == SDP_TRANSPORT_AAL2_ITU) ||
         (mca_p->transport == SDP_TRANSPORT_AAL2_ATMF) ||
         (mca_p->transport == SDP_TRANSPORT_AAL2_CUSTOM)) {
 
         if (sdp_parse_multiple_profile_payload_types(sdp_p, mca_p, ptr) !=
             SDP_SUCCESS) {
             sdp_p->conf_p->num_invalid_param++;
-	    SDP_FREE(mca_p);
+            SDP_FREE(mca_p);
             return (SDP_INVALID_PARAMETER);
         }
-    } else {
-        /* Transport is a non-AAL2 type.  Parse payloads normally. */
-        sdp_parse_payload_types(sdp_p, mca_p, ptr);
-    }
-
     /* Parse DTLS/SCTP port */
-    if (mca_p->transport == SDP_TRANSPORT_DTLSSCTP) {
+    } else if (mca_p->transport == SDP_TRANSPORT_DTLSSCTP) {
         ptr = sdp_getnextstrtok(ptr, port, sizeof(port), " \t", &result);
         if (result != SDP_SUCCESS) {
             sdp_parse_error(sdp_p->peerconnection,
                 "%s No sctp port specified in m= media line, "
                 "parse failed.", sdp_p->debug_str);
             SDP_FREE(mca_p);
             sdp_p->conf_p->num_invalid_param++;
             return (SDP_INVALID_PARAMETER);
         }
         port_ptr = port;
 
         if (sdp_getchoosetok(port_ptr, &port_ptr, "/ \t", &result)) {
-        	sctp_port = SDP_CHOOSE_PARAM;
+            sctp_port = SDP_CHOOSE_PARAM;
         } else {
-        	sctp_port = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
+            sctp_port = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
                                            "/ \t", &result);
             if (result != SDP_SUCCESS) {
-            	return (SDP_INVALID_PARAMETER);
+                return (SDP_INVALID_PARAMETER);
             }
             mca_p->sctpport = sctp_port;
         }
+    } else {
+        /* Transport is a non-AAL2 type and not SCTP.  Parse payloads
+           normally. */
+        sdp_parse_payload_types(sdp_p, mca_p, ptr);
     }
 
+
     /* Media line params are valid.  Add it into the SDP. */
     sdp_p->mca_count++;
     if (sdp_p->mca_p == NULL) {
         sdp_p->mca_p = mca_p;
     } else {
         for (next_mca_p = sdp_p->mca_p; next_mca_p->next_p != NULL;
              next_mca_p = next_mca_p->next_p) {
             ; // Empty For