]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9654
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 26 Oct 2016 02:09:53 +0000 (21:09 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 26 Oct 2016 02:09:53 +0000 (21:09 -0500)
src/switch_core_media.c

index 90e616b8420ebf8ba4cdfbcdcefc25a85730e131..9d2395b1430b3c62a64326dd4d06906f1079668f 100644 (file)
@@ -825,8 +825,19 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
                                exists = (type == pmap->type && !strcasecmp(name, pmap->iananame));
                                break;
                        }
+                       
+                       if (exists) {
+
+                               if (!zstr(fmtp) && !zstr(pmap->rm_fmtp)) {
+                                       if (strcmp(pmap->rm_fmtp, fmtp)) {
+                                               exists = 0;
+                                               local_pt = pmap->pt;
+                                               continue;
+                                       }
+                               }
 
-                       if (exists) break;
+                               break;
+                       }
 
                } else {
                        if (type == SWITCH_MEDIA_TYPE_TEXT) {
@@ -5402,12 +5413,30 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                vmatch = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
                                        }
 
+                                       if (sdp_type == SDP_TYPE_RESPONSE && vmatch && map->rm_fmtp) {
+                                               int fmatch = 0;
+                                               int fcount = 0;
+                                               payload_map_t *pmap;
+                                               
+                                               for (pmap = v_engine->payload_map; pmap && pmap->allocated; pmap = pmap->next) {
+                                                       if (pmap->rm_fmtp) {
+                                                               fcount++;
+                                                               if ((fmatch = !strcasecmp(pmap->rm_fmtp, map->rm_fmtp))) {
+                                                                       break;
+                                                               }
+                                                       }
+                                               }
+
+                                               if (fcount && !fmatch) {
+                                                       vmatch = 0;
+                                               }
+                                       }
+
                                        if (vmatch && vmatch_pt) {
                                                const char *other_pt = switch_channel_get_variable_partner(channel, "rtp_video_pt");
 
                                                if (other_pt) {
                                                        int opt = atoi(other_pt);
-
                                                        if (map->rm_pt != opt) {
                                                                vmatch = 0;
                                                        }
@@ -5483,9 +5512,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
 
                                        pmap->remote_sdp_ip = switch_core_session_strdup(session, (char *) connection->c_address);
                                        pmap->remote_sdp_port = (switch_port_t) m->m_port;
-                                               
                                        pmap->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
-
                                        smh->negotiated_codecs[smh->num_negotiated_codecs++] = mimp;                                    
                                                
 #if 0
@@ -9102,7 +9129,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                                                                  imp->codec_type == SWITCH_CODEC_TYPE_AUDIO ? SWITCH_MEDIA_TYPE_AUDIO : SWITCH_MEDIA_TYPE_VIDEO,
                                                                                                  imp->iananame,
                                                                                                  imp->modname,
-                                                                                                 NULL,
+                                                                                                 smh->fmtps[i],
                                                                                                  sdp_type,
                                                                                                  smh->ianacodes[i],
                                                                                                  imp->samples_per_second,