From d2f7010141e8d9666555223e239c907654038030 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Mon, 4 Jan 2021 20:37:16 +0100 Subject: [PATCH] Call ondowntrack on each track. We used to call it on just the first track. Also remove obsolete remains of the onlabel callback. --- static/protocol.js | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/static/protocol.js b/static/protocol.js index 62f524b..bcc4c15 100644 --- a/static/protocol.js +++ b/static/protocol.js @@ -561,19 +561,11 @@ ServerConnection.prototype.gotOffer = async function(id, labels, source, usernam } else { console.warn("Couldn't find label for track"); } - if(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) { - c.ondowntrack.call( - c, e.track, e.transceiver, label, e.streams[0], - ); - } - if(c.onlabel) { - c.onlabel.call(c, label); - } + c.stream = e.streams[0]; + if(c.ondowntrack) { + c.ondowntrack.call( + c, e.track, e.transceiver, label, e.streams[0], + ); } }; } @@ -860,12 +852,6 @@ function Stream(sc, id, pc, up) { * @type{(this: Stream, track: MediaStreamTrack, transceiver: RTCRtpTransceiver, label: string, stream: MediaStream) => void} */ 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. *