|
|
@@ -19,6 +19,14 @@
|
|
19
|
19
|
*/
|
|
20
|
20
|
|
|
21
|
21
|
var SDP = require('./SDP');
|
|
|
22
|
+var RTCBrowserType = require('../RTC/RTCBrowserType');
|
|
|
23
|
+
|
|
|
24
|
+/**
|
|
|
25
|
+ * The hack is enabled on all browsers except FF by default
|
|
|
26
|
+ * FIXME finish the hack once removeStream method is implemented in FF
|
|
|
27
|
+ * @type {boolean}
|
|
|
28
|
+ */
|
|
|
29
|
+var isEnabled = !RTCBrowserType.isFirefox();
|
|
22
|
30
|
|
|
23
|
31
|
/**
|
|
24
|
32
|
* Stored SSRC of local video stream.
|
|
|
@@ -94,6 +102,9 @@ var LocalVideoSSRCHack = {
|
|
94
|
102
|
* which will be scanned for local video SSRC.
|
|
95
|
103
|
*/
|
|
96
|
104
|
processSessionInit: function (sessionInit) {
|
|
|
105
|
+ if (!isEnabled)
|
|
|
106
|
+ return;
|
|
|
107
|
+
|
|
97
|
108
|
if (localVideoSSRC) {
|
|
98
|
109
|
console.error("Local SSRC stored already: " + localVideoSSRC);
|
|
99
|
110
|
return;
|
|
|
@@ -109,6 +120,9 @@ var LocalVideoSSRCHack = {
|
|
109
|
120
|
* @returns modified <tt>localDescription</tt> object.
|
|
110
|
121
|
*/
|
|
111
|
122
|
mungeLocalVideoSSRC: function (localDescription) {
|
|
|
123
|
+ if (!isEnabled)
|
|
|
124
|
+ return localDescription;
|
|
|
125
|
+
|
|
112
|
126
|
// IF we have local video SSRC stored make sure it is replaced
|
|
113
|
127
|
// with old SSRC
|
|
114
|
128
|
if (localVideoSSRC) {
|
|
|
@@ -144,6 +158,9 @@ var LocalVideoSSRCHack = {
|
|
144
|
158
|
* a Strophe IQ Builder instance, but DOM element tree.
|
|
145
|
159
|
*/
|
|
146
|
160
|
processSourceAdd: function (sourceAdd) {
|
|
|
161
|
+ if (!isEnabled)
|
|
|
162
|
+ return sourceAdd;
|
|
|
163
|
+
|
|
147
|
164
|
if (!localVideoSSRC) {
|
|
148
|
165
|
// Store local SSRC if available
|
|
149
|
166
|
storeLocalVideoSSRC(sourceAdd);
|
|
|
@@ -163,7 +180,19 @@ var LocalVideoSSRCHack = {
|
|
163
|
180
|
* a Strophe IQ Builder instance, but DOM element tree.
|
|
164
|
181
|
*/
|
|
165
|
182
|
processSourceRemove: function (sourceRemove) {
|
|
|
183
|
+ if (!isEnabled)
|
|
|
184
|
+ return sourceRemove;
|
|
|
185
|
+
|
|
166
|
186
|
return filterOutSource(sourceRemove, 'source-remove');
|
|
|
187
|
+ },
|
|
|
188
|
+
|
|
|
189
|
+ /**
|
|
|
190
|
+ * Turns the hack on or off
|
|
|
191
|
+ * @param enabled <tt>true</tt> to enable the hack or <tt>false</tt>
|
|
|
192
|
+ * to disable it
|
|
|
193
|
+ */
|
|
|
194
|
+ setEnabled: function (enabled) {
|
|
|
195
|
+ isEnabled = enabled;
|
|
167
|
196
|
}
|
|
168
|
197
|
};
|
|
169
|
198
|
|