1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-23 00:55:58 +01:00

Call ondowntrack on each track.

We used to call it on just the first track.  Also remove obsolete
remains of the onlabel callback.
This commit is contained in:
Juliusz Chroboczek 2021-01-04 20:37:16 +01:00
parent 5735322627
commit d2f7010141

View file

@ -561,20 +561,12 @@ ServerConnection.prototype.gotOffer = async function(id, labels, source, usernam
} else { } else {
console.warn("Couldn't find label for track"); console.warn("Couldn't find label for track");
} }
if(c.stream !== e.streams[0]) {
c.stream = e.streams[0]; c.stream = e.streams[0];
let label =
e.transceiver && c.labelsByMid[e.transceiver.mid];
c.labels[e.track.id] = label;
if(c.ondowntrack) { if(c.ondowntrack) {
c.ondowntrack.call( c.ondowntrack.call(
c, e.track, e.transceiver, label, e.streams[0], c, e.track, e.transceiver, label, e.streams[0],
); );
} }
if(c.onlabel) {
c.onlabel.call(c, label);
}
}
}; };
} }
@ -860,12 +852,6 @@ function Stream(sc, id, pc, up) {
* @type{(this: Stream, track: MediaStreamTrack, transceiver: RTCRtpTransceiver, label: string, stream: MediaStream) => void} * @type{(this: Stream, track: MediaStreamTrack, transceiver: RTCRtpTransceiver, label: string, stream: MediaStream) => void}
*/ */
this.ondowntrack = null; this.ondowntrack = null;
/**
* onlabel is called whenever the server sets a new label for the stream.
*
* @type{(this: Stream, label: string) => void}
*/
this.onlabel = null;
/** /**
* onstatus is called whenever the status of the stream changes. * onstatus is called whenever the status of the stream changes.
* *