1
Fork 0

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
1 changed files with 5 additions and 19 deletions

View File

@ -561,19 +561,11 @@ 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]; if(c.ondowntrack) {
let label = c.ondowntrack.call(
e.transceiver && c.labelsByMid[e.transceiver.mid]; c, e.track, e.transceiver, label, e.streams[0],
c.labels[e.track.id] = label; );
if(c.ondowntrack) {
c.ondowntrack.call(
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.
* *