Commit 346f93dd authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

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.
parent 39789dc8
...@@ -701,6 +701,13 @@ function Stream(sc, id, pc) { ...@@ -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) { ...@@ -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;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment