1
Fork 0

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:
Juliusz Chroboczek 2020-09-10 01:13:15 +02:00
parent 39789dc89a
commit 346f93dd16
1 changed files with 9 additions and 1 deletions

View File

@ -701,6 +701,13 @@ function Stream(sc, id, pc) {
* @type {Array.<RTCIceCandidate>}
*/
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
* 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({
type: 'offer',
kind: 'renegotiate',
kind: this.renegotiate ? 'renegotiate' : '',
id: c.id,
labels: c.labelsByMid,
offer: offer,
});
this.renegotiate = true;
}
/**