Pārlūkot izejas kodu

feat(Safari): Add unified plan support for Safari

Enabled desktop sharing and discontinue support for Safari versions prior to 12.1, i.e., the ones with no VP8 support
dev1
Jaya Allamsetty 5 gadus atpakaļ
vecāks
revīzija
3882a82f8f

+ 2
- 2
modules/RTC/RTCUtils.js Parādīt failu

179
     // @see https://github.com/jitsi/lib-jitsi-meet/pull/136
179
     // @see https://github.com/jitsi/lib-jitsi-meet/pull/136
180
     const isNewStyleConstraintsSupported
180
     const isNewStyleConstraintsSupported
181
         = browser.isFirefox()
181
         = browser.isFirefox()
182
-            || browser.isSafariWithVP8()
182
+            || browser.isSafari()
183
             || browser.isReactNative();
183
             || browser.isReactNative();
184
 
184
 
185
     if (um.indexOf('video') >= 0) {
185
     if (um.indexOf('video') >= 0) {
1435
     isDeviceChangeAvailable(deviceType) {
1435
     isDeviceChangeAvailable(deviceType) {
1436
         return deviceType === 'output' || deviceType === 'audiooutput'
1436
         return deviceType === 'output' || deviceType === 'audiooutput'
1437
             ? isAudioOutputDeviceChangeAvailable
1437
             ? isAudioOutputDeviceChangeAvailable
1438
-            : !browser.isSafariWithVP8();
1438
+            : !browser.isSafari();
1439
     }
1439
     }
1440
 
1440
 
1441
     /**
1441
     /**

+ 2
- 0
modules/RTC/ScreenObtainer.js Parādīt failu

142
 
142
 
143
             // Legacy Firefox
143
             // Legacy Firefox
144
             return this.obtainScreenOnFirefox;
144
             return this.obtainScreenOnFirefox;
145
+        } else if (browser.isSafari() && browser.supportsGetDisplayMedia()) {
146
+            return this.obtainScreenFromGetDisplayMedia;
145
         }
147
         }
146
 
148
 
147
         logger.log(
149
         logger.log(

+ 6
- 21
modules/RTC/TPCUtils.js Parādīt failu

193
     /**
193
     /**
194
      * Adds a track on the RTCRtpSender as part of the unmute operation.
194
      * Adds a track on the RTCRtpSender as part of the unmute operation.
195
      * @param {JitsiLocalTrack} localTrack - track to be unmuted.
195
      * @param {JitsiLocalTrack} localTrack - track to be unmuted.
196
-     * @returns {boolean} Returns true if the operation is successful,
197
-     * false otherwise.
196
+     * @returns {Promise<void>}
198
      */
197
      */
199
     addTrackUnmute(localTrack) {
198
     addTrackUnmute(localTrack) {
200
         const mediaType = localTrack.getType();
199
         const mediaType = localTrack.getType();
222
 
221
 
223
             return true;
222
             return true;
224
         }
223
         }
225
-        transceiver.sender.replaceTrack(track)
224
+
225
+        return transceiver.sender.replaceTrack(track)
226
             .then(() => {
226
             .then(() => {
227
                 this.pc.localTracks.set(localTrack.rtcId, localTrack);
227
                 this.pc.localTracks.set(localTrack.rtcId, localTrack);
228
-
229
-                return true;
230
-            })
231
-            .catch(err => {
232
-                logger.error(`Unmute track failed for ${mediaType} track on ${this.pc}, ${err}`);
233
-
234
-                return false;
235
             });
228
             });
236
     }
229
     }
237
 
230
 
238
     /**
231
     /**
239
      * Removes the track from the RTCRtpSender as part of the mute operation.
232
      * Removes the track from the RTCRtpSender as part of the mute operation.
240
      * @param {JitsiLocalTrack} localTrack - track to be removed.
233
      * @param {JitsiLocalTrack} localTrack - track to be removed.
241
-     * @returns {boolean} Returns true if the operation is successful,
242
-     * false otherwise.
234
+     * @returns {Promise<void>}
243
      */
235
      */
244
     removeTrackMute(localTrack) {
236
     removeTrackMute(localTrack) {
245
         const mediaType = localTrack.getType();
237
         const mediaType = localTrack.getType();
253
         }
245
         }
254
 
246
 
255
         logger.debug(`Removing ${localTrack} on ${this.pc}`);
247
         logger.debug(`Removing ${localTrack} on ${this.pc}`);
256
-        transceiver.sender.replaceTrack(null)
248
+
249
+        return transceiver.sender.replaceTrack(null)
257
             .then(() => {
250
             .then(() => {
258
                 this.pc.localTracks.delete(localTrack.rtcId);
251
                 this.pc.localTracks.delete(localTrack.rtcId);
259
-                this.pc.localSSRCs.delete(localTrack.rtcId);
260
-
261
-                return true;
262
-            })
263
-            .catch(err => {
264
-                logger.error(`Mute track failed for ${mediaType} track on ${this.pc}, ${err}`);
265
-
266
-                return false;
267
             });
252
             });
268
     }
253
     }
269
 
254
 

+ 7
- 8
modules/RTC/TraceablePeerConnection.js Parādīt failu

1481
  * the renegotiation is required or <tt>false</tt> otherwise.
1481
  * the renegotiation is required or <tt>false</tt> otherwise.
1482
  */
1482
  */
1483
 TraceablePeerConnection.prototype.addTrackUnmute = function(track) {
1483
 TraceablePeerConnection.prototype.addTrackUnmute = function(track) {
1484
+    if (browser.usesUnifiedPlan()) {
1485
+        return this.tpcUtils.addTrackUnmute(track);
1486
+    }
1484
     if (!this._assertTrackBelongs('addTrackUnmute', track)) {
1487
     if (!this._assertTrackBelongs('addTrackUnmute', track)) {
1485
         // Abort
1488
         // Abort
1486
         return false;
1489
         return false;
1487
     }
1490
     }
1488
 
1491
 
1489
     logger.info(`Adding ${track} as unmute to ${this}`);
1492
     logger.info(`Adding ${track} as unmute to ${this}`);
1490
-    if (browser.usesUnifiedPlan()) {
1491
-        return this.tpcUtils.addTrackUnmute(track);
1492
-    }
1493
     const webRtcStream = track.getOriginalStream();
1493
     const webRtcStream = track.getOriginalStream();
1494
 
1494
 
1495
     if (!webRtcStream) {
1495
     if (!webRtcStream) {
1680
  * changed and the renegotiation is required or <tt>false</tt> otherwise.
1680
  * changed and the renegotiation is required or <tt>false</tt> otherwise.
1681
  */
1681
  */
1682
 TraceablePeerConnection.prototype.removeTrackMute = function(localTrack) {
1682
 TraceablePeerConnection.prototype.removeTrackMute = function(localTrack) {
1683
+    if (browser.usesUnifiedPlan()) {
1684
+        return this.tpcUtils.removeTrackMute(localTrack);
1685
+    }
1683
     const webRtcStream = localTrack.getOriginalStream();
1686
     const webRtcStream = localTrack.getOriginalStream();
1684
 
1687
 
1685
     this.trace(
1688
     this.trace(
1690
         // Abort - nothing to be done here
1693
         // Abort - nothing to be done here
1691
         return false;
1694
         return false;
1692
     }
1695
     }
1693
-    if (browser.usesUnifiedPlan()) {
1694
-        return this.tpcUtils.removeTrackMute(localTrack);
1695
-    }
1696
     if (webRtcStream) {
1696
     if (webRtcStream) {
1697
         logger.info(
1697
         logger.info(
1698
             `Removing ${localTrack} as mute from ${this}`);
1698
             `Removing ${localTrack} as mute from ${this}`);
2480
     // TODO (brian): After moving all browsers to adapter, check if adapter is
2480
     // TODO (brian): After moving all browsers to adapter, check if adapter is
2481
     // accounting for different getStats apis, making the browser-checking-if
2481
     // accounting for different getStats apis, making the browser-checking-if
2482
     // unnecessary.
2482
     // unnecessary.
2483
-    if (browser.isSafariWithWebrtc() || browser.isFirefox()
2484
-            || browser.isReactNative()) {
2483
+    if (browser.isSafari() || browser.isFirefox() || browser.isReactNative()) {
2485
         // uses the new Promise based getStats
2484
         // uses the new Promise based getStats
2486
         this.peerconnection.getStats()
2485
         this.peerconnection.getStats()
2487
             .then(callback)
2486
             .then(callback)

+ 11
- 42
modules/browser/BrowserCapabilities.js Parādīt failu

30
      * strategy or <tt>false</tt> otherwise.
30
      * strategy or <tt>false</tt> otherwise.
31
      */
31
      */
32
     doesVideoMuteByStreamRemove() {
32
     doesVideoMuteByStreamRemove() {
33
-        return this.isChromiumBased();
33
+        return this.isChromiumBased() || this.isSafari();
34
     }
34
     }
35
 
35
 
36
     /**
36
     /**
61
             || this.isOpera();
61
             || this.isOpera();
62
     }
62
     }
63
 
63
 
64
-    /**
65
-     * Checks if current browser is a Safari and a version of Safari that
66
-     * supports native webrtc.
67
-     *
68
-     * @returns {boolean}
69
-     */
70
-    isSafariWithWebrtc() {
71
-        return this.isSafari()
72
-            && !this.isVersionLessThan('11');
73
-    }
74
-
75
-    /**
76
-     * Checks if current browser is a Safari and a version of Safari that
77
-     * supports VP8.
78
-     *
79
-     * @returns {boolean}
80
-     */
81
-    isSafariWithVP8() {
82
-        return this.isSafari()
83
-            && !this.isVersionLessThan('12.1');
84
-    }
85
-
86
     /**
64
     /**
87
      * Checks if the current browser is supported.
65
      * Checks if the current browser is supported.
88
      *
66
      *
92
         return this.isChromiumBased()
70
         return this.isChromiumBased()
93
             || this.isFirefox()
71
             || this.isFirefox()
94
             || this.isReactNative()
72
             || this.isReactNative()
95
-            || this.isSafariWithWebrtc();
73
+            || (this.isSafari() && !this.isVersionLessThan('12.1'));
96
     }
74
     }
97
 
75
 
98
     /**
76
     /**
112
      * otherwise.
90
      * otherwise.
113
      */
91
      */
114
     supportsVideoMuteOnConnInterrupted() {
92
     supportsVideoMuteOnConnInterrupted() {
115
-        return this.isChromiumBased() || this.isReactNative()
116
-            || this.isSafariWithVP8();
93
+        return this.isChromiumBased() || this.isReactNative() || this.isSafari();
117
     }
94
     }
118
 
95
 
119
     /**
96
     /**
124
     supportsBandwidthStatistics() {
101
     supportsBandwidthStatistics() {
125
         // FIXME bandwidth stats are currently not implemented for FF on our
102
         // FIXME bandwidth stats are currently not implemented for FF on our
126
         // side, but not sure if not possible ?
103
         // side, but not sure if not possible ?
127
-        return !this.isFirefox() && !this.isSafariWithWebrtc();
104
+        return !this.isFirefox() && !this.isSafari();
128
     }
105
     }
129
 
106
 
130
     /**
107
     /**
142
      * candidates through the legacy getStats() API.
119
      * candidates through the legacy getStats() API.
143
      */
120
      */
144
     supportsLocalCandidateRttStatistics() {
121
     supportsLocalCandidateRttStatistics() {
145
-        return this.isChromiumBased() || this.isReactNative()
146
-            || this.isSafariWithVP8();
122
+        return this.isChromiumBased() || this.isReactNative() || this.isSafari();
147
     }
123
     }
148
 
124
 
149
     /**
125
     /**
169
      * @returns {boolean}
145
      * @returns {boolean}
170
      */
146
      */
171
     supportsRtpSender() {
147
     supportsRtpSender() {
172
-        return this.isFirefox() || this.isSafariWithVP8();
148
+        return this.isFirefox() || this.isSafari();
173
     }
149
     }
174
 
150
 
175
     /**
151
     /**
178
      * @returns {boolean}
154
      * @returns {boolean}
179
      */
155
      */
180
     supportsRtx() {
156
     supportsRtx() {
181
-        return !this.isFirefox() && !this.usesUnifiedPlan();
157
+        return !this.isFirefox();
182
     }
158
     }
183
 
159
 
184
     /**
160
     /**
188
      * @returns {boolean}
164
      * @returns {boolean}
189
      */
165
      */
190
     supportsVideo() {
166
     supportsVideo() {
191
-        // FIXME: Check if we can use supportsVideoOut and supportsVideoIn. I
192
-        // leave the old implementation here in order not to brake something.
193
-
194
-        // Older versions of Safari using webrtc/adapter do not support video
195
-        // due in part to Safari only supporting H264 and the bridge sending VP8
196
-        // Newer Safari support VP8 and other WebRTC features.
197
-        return !this.isSafariWithWebrtc()
198
-            || (this.isSafariWithVP8() && this.usesPlanB());
167
+        return true;
199
     }
168
     }
200
 
169
 
201
     /**
170
     /**
213
      * @returns {boolean}
182
      * @returns {boolean}
214
      */
183
      */
215
     usesSdpMungingForSimulcast() {
184
     usesSdpMungingForSimulcast() {
216
-        return this.isChromiumBased() || this.isSafariWithVP8();
185
+        return this.isChromiumBased() || this.isSafari();
217
     }
186
     }
218
 
187
 
219
     /**
188
     /**
226
             return true;
195
             return true;
227
         }
196
         }
228
 
197
 
229
-        if (this.isSafariWithVP8() && typeof window.RTCRtpTransceiver !== 'undefined') {
198
+        if (this.isSafari() && typeof window.RTCRtpTransceiver !== 'undefined') {
230
             // eslint-disable-next-line max-len
199
             // eslint-disable-next-line max-len
231
             // https://trac.webkit.org/changeset/236144/webkit/trunk/LayoutTests/webrtc/video-addLegacyTransceiver.html
200
             // https://trac.webkit.org/changeset/236144/webkit/trunk/LayoutTests/webrtc/video-addLegacyTransceiver.html
232
             // eslint-disable-next-line no-undef
201
             // eslint-disable-next-line no-undef
252
             return !this.isVersionLessThan(REQUIRED_CHROME_VERSION);
221
             return !this.isVersionLessThan(REQUIRED_CHROME_VERSION);
253
         }
222
         }
254
 
223
 
255
-        if (this.isFirefox() || this.isSafariWithWebrtc()) {
224
+        if (this.isFirefox() || this.isSafari()) {
256
             return true;
225
             return true;
257
         }
226
         }
258
 
227
 

+ 1
- 1
modules/statistics/RTPStatsCollector.js Parādīt failu

215
      * @type {boolean}
215
      * @type {boolean}
216
      */
216
      */
217
     this._usesPromiseGetStats
217
     this._usesPromiseGetStats
218
-        = browser.isSafariWithWebrtc() || browser.isFirefox();
218
+        = browser.isSafari() || browser.isFirefox();
219
 
219
 
220
     /**
220
     /**
221
      * The function which is to be used to retrieve the value associated in a
221
      * The function which is to be used to retrieve the value associated in a

Notiek ielāde…
Atcelt
Saglabāt