Maintain information about whether renegotiation is permitted.
Renegotiation is not correct when the stream is fresh, for example after the user has switched the camera.
This commit is contained in:
+9
-1
@@ -701,6 +701,13 @@ function Stream(sc, id, pc) {
|
|||||||
* @type {Array.<RTCIceCandidate>}
|
* @type {Array.<RTCIceCandidate>}
|
||||||
*/
|
*/
|
||||||
this.iceCandidates = [];
|
this.iceCandidates = [];
|
||||||
|
/**
|
||||||
|
* Indicates whether it is legal to renegotiate at this point. If
|
||||||
|
* this is false, a new connection must be negotiated.
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.renegotiate = false;
|
||||||
/**
|
/**
|
||||||
* The statistics last computed by the stats handler. This is
|
* The statistics last computed by the stats handler. This is
|
||||||
* a dictionary indexed by track id, with each value a disctionary of
|
* a dictionary indexed by track id, with each value a disctionary of
|
||||||
@@ -854,11 +861,12 @@ Stream.prototype.negotiate = async function (restartIce) {
|
|||||||
|
|
||||||
c.sc.send({
|
c.sc.send({
|
||||||
type: 'offer',
|
type: 'offer',
|
||||||
kind: 'renegotiate',
|
kind: this.renegotiate ? 'renegotiate' : '',
|
||||||
id: c.id,
|
id: c.id,
|
||||||
labels: c.labelsByMid,
|
labels: c.labelsByMid,
|
||||||
offer: offer,
|
offer: offer,
|
||||||
});
|
});
|
||||||
|
this.renegotiate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user