|
@@ -2456,65 +2456,6 @@ TraceablePeerConnection.prototype.close = function() {
|
2456
|
2456
|
this.peerconnection.close();
|
2457
|
2457
|
};
|
2458
|
2458
|
|
2459
|
|
-/**
|
2460
|
|
- * Modifies the values of the setup attributes (defined by
|
2461
|
|
- * {@link http://tools.ietf.org/html/rfc4145#section-4}) of a specific SDP
|
2462
|
|
- * answer in order to overcome a delay of 1 second in the connection
|
2463
|
|
- * establishment between some devices and Videobridge.
|
2464
|
|
- *
|
2465
|
|
- * @param {SDP} offer - the SDP offer to which the specified SDP answer is
|
2466
|
|
- * being prepared to respond
|
2467
|
|
- * @param {SDP} answer - the SDP to modify
|
2468
|
|
- * @private
|
2469
|
|
- */
|
2470
|
|
-const _fixAnswerRFC4145Setup = function(offer, answer) {
|
2471
|
|
- if (!(browser.isChromiumBased() || browser.isReactNative())) {
|
2472
|
|
- // It looks like Firefox doesn't agree with the fix (at least in its
|
2473
|
|
- // current implementation) because it effectively remains active even
|
2474
|
|
- // after we tell it to become passive. Apart from Firefox which I tested
|
2475
|
|
- // after the fix was deployed, I tested Chrome only. In order to prevent
|
2476
|
|
- // issues with other browsers, limit the fix to known devices for the
|
2477
|
|
- // time being.
|
2478
|
|
- return;
|
2479
|
|
- }
|
2480
|
|
-
|
2481
|
|
- // XXX Videobridge is the (SDP) offerer and WebRTC (e.g. Chrome) is the
|
2482
|
|
- // answerer (as orchestrated by Jicofo). In accord with
|
2483
|
|
- // http://tools.ietf.org/html/rfc5245#section-5.2 and because both peers
|
2484
|
|
- // are ICE FULL agents, Videobridge will take on the controlling role and
|
2485
|
|
- // WebRTC will take on the controlled role. In accord with
|
2486
|
|
- // https://tools.ietf.org/html/rfc5763#section-5, Videobridge will use the
|
2487
|
|
- // setup attribute value of setup:actpass and WebRTC will be allowed to
|
2488
|
|
- // choose either the setup attribute value of setup:active or
|
2489
|
|
- // setup:passive. Chrome will by default choose setup:active because it is
|
2490
|
|
- // RECOMMENDED by the respective RFC since setup:passive adds additional
|
2491
|
|
- // latency. The case of setup:active allows WebRTC to send a DTLS
|
2492
|
|
- // ClientHello as soon as an ICE connectivity check of its succeeds.
|
2493
|
|
- // Unfortunately, Videobridge will be unable to respond immediately because
|
2494
|
|
- // may not have WebRTC's answer or may have not completed the ICE
|
2495
|
|
- // connectivity establishment. Even more unfortunate is that in the
|
2496
|
|
- // described scenario Chrome's DTLS implementation will insist on
|
2497
|
|
- // retransmitting its ClientHello after a second (the time is in accord
|
2498
|
|
- // with the respective RFC) and will thus cause the whole connection
|
2499
|
|
- // establishment to exceed at least 1 second. To work around Chrome's
|
2500
|
|
- // idiosyncracy, don't allow it to send a ClientHello i.e. change its
|
2501
|
|
- // default choice of setup:active to setup:passive.
|
2502
|
|
- if (offer && answer
|
2503
|
|
- && offer.media && answer.media
|
2504
|
|
- && offer.media.length === answer.media.length) {
|
2505
|
|
- answer.media.forEach((a, i) => {
|
2506
|
|
- if (SDPUtil.findLine(
|
2507
|
|
- offer.media[i],
|
2508
|
|
- 'a=setup:actpass',
|
2509
|
|
- offer.session)) {
|
2510
|
|
- answer.media[i]
|
2511
|
|
- = a.replace(/a=setup:active/g, 'a=setup:passive');
|
2512
|
|
- }
|
2513
|
|
- });
|
2514
|
|
- answer.raw = answer.session + answer.media.join('');
|
2515
|
|
- }
|
2516
|
|
-};
|
2517
|
|
-
|
2518
|
2459
|
TraceablePeerConnection.prototype.createAnswer = function(constraints) {
|
2519
|
2460
|
return this._createOfferOrAnswer(false /* answer */, constraints);
|
2520
|
2461
|
};
|
|
@@ -2594,22 +2535,6 @@ TraceablePeerConnection.prototype._createOfferOrAnswer = function(
|
2594
|
2535
|
dumpSDP(resultSdp));
|
2595
|
2536
|
}
|
2596
|
2537
|
|
2597
|
|
- // Fix the setup attribute (see _fixAnswerRFC4145Setup for
|
2598
|
|
- // details)
|
2599
|
|
- if (!isOffer) {
|
2600
|
|
- const remoteDescription
|
2601
|
|
- = new SDP(this.remoteDescription.sdp);
|
2602
|
|
- const localDescription = new SDP(resultSdp.sdp);
|
2603
|
|
-
|
2604
|
|
- _fixAnswerRFC4145Setup(remoteDescription, localDescription);
|
2605
|
|
-
|
2606
|
|
- // eslint-disable-next-line no-param-reassign
|
2607
|
|
- resultSdp = new RTCSessionDescription({
|
2608
|
|
- type: resultSdp.type,
|
2609
|
|
- sdp: localDescription.raw
|
2610
|
|
- });
|
2611
|
|
- }
|
2612
|
|
-
|
2613
|
2538
|
const ssrcMap = extractSSRCMap(resultSdp);
|
2614
|
2539
|
|
2615
|
2540
|
logger.debug('Got local SSRCs MAP: ', ssrcMap);
|