瀏覽代碼

Detects msid changes in sdp.

The case where we had created recvonly streams (start muted on FF) and we are unmuting, this creates a sendrecv stream and adds msid, we need to signal msid so listeners to be notified and create appropriate audio/video element and to start receiving the stream.
master
damencho 7 年之前
父節點
當前提交
98acf1336d
共有 1 個檔案被更改,包括 20 行新增0 行删除
  1. 20
    0
      modules/xmpp/SDPDiffer.js

+ 20
- 0
modules/xmpp/SDPDiffer.js 查看文件

@@ -84,6 +84,26 @@ SDPDiffer.prototype.getNewMedia = function() {
84 84
                     };
85 85
                 }
86 86
                 newMedia[othersMediaIdx].ssrcs[ssrc] = othersMedia.ssrcs[ssrc];
87
+            } else if (othersMedia.ssrcs[ssrc].lines
88
+                        && myMedia.ssrcs[ssrc].lines) {
89
+                // we want to detect just changes in adding/removing msid
90
+                const myContainMsid = myMedia.ssrcs[ssrc].lines.find(
91
+                    line => line.indexOf('msid') !== -1) !== undefined;
92
+                const newContainMsid = othersMedia.ssrcs[ssrc].lines.find(
93
+                    line => line.indexOf('msid') !== -1) !== undefined;
94
+
95
+                if (myContainMsid !== newContainMsid) {
96
+                    if (!newMedia[othersMediaIdx]) {
97
+                        newMedia[othersMediaIdx] = {
98
+                            mediaindex: othersMedia.mediaindex,
99
+                            mid: othersMedia.mid,
100
+                            ssrcs: {},
101
+                            ssrcGroups: []
102
+                        };
103
+                    }
104
+                    newMedia[othersMediaIdx].ssrcs[ssrc]
105
+                        = othersMedia.ssrcs[ssrc];
106
+                }
87 107
             }
88 108
         });
89 109
 

Loading…
取消
儲存