浏览代码

modules/mediaproxy: Fix SDP mangling for unsupported streams.
- Credits to Saul Ibarra.

Juha Heinanen 15 年之前
父节点
当前提交
5f78020b2d
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      modules/mediaproxy/mediaproxy.c

+ 5 - 1
modules/mediaproxy/mediaproxy.c

@@ -1733,7 +1733,7 @@ use_media_proxy(struct sip_msg *msg, char *dialog_id, ice_candidate_data *ice_da
         }
     }
 
-    for (i=0, j=1; i<session.stream_count && j<len; i++) {
+    for (i=0, j=1; i<session.stream_count; i++) {
         stream = session.streams[i];
         if (stream.transport != TSupported) {
             if (!stream.local_ip && removed_session_ip) {
@@ -1748,6 +1748,10 @@ use_media_proxy(struct sip_msg *msg, char *dialog_id, ice_candidate_data *ice_da
             continue;
         }
 
+        if (j >= len) {
+            break;
+        }
+        
         if (!isnullport(stream.port)) {
             if (!replace_element(msg, &stream.port, &tokens[j])) {
                 LM_ERR("failed to replace port in media stream number %d\n", i+1);