From d236f4c6df88de5bb5b15246e055c425ee7e335a Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Thu, 13 May 2021 03:45:06 +0200 Subject: [PATCH] Work around empty track id and msid. --- rtpconn/webclient.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index 0678bd8..db24b47 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -361,9 +361,25 @@ func addDownTrackUnlocked(conn *rtpDownConnection, remoteTrack *rtpUpTrack, remo } } + id := remoteTrack.track.ID() + if id == "" { + log.Println("Got track with empty id") + id = remoteTrack.track.RID() + } + if id == "" { + id = remoteTrack.track.Kind().String() + } + msid := remoteTrack.track.StreamID() + if msid == "" { + log.Println("Got track with empty msid") + msid = remoteConn.Label() + } + if msid == "" { + msid = "dummy" + } + local, err := webrtc.NewTrackLocalStaticRTP( - remoteTrack.Codec(), - remoteTrack.track.ID(), remoteTrack.track.StreamID(), + remoteTrack.Codec(), id, msid, ) if err != nil { return err