Avoid matching on empty track id. (#3937)
Due to SDP ordering, Pion did not provide track ID on a receiver. Pion needs a=msid line to be before a=ssrc line -> need to check if this is a spec requirement Because of the above, it had empty id for the receiver in onTrack. That matched a published track because we do not duplicate SdpCid in TrackInfo if the SDP cid matches the signal cid. But, the search checks both and it matched on empty SDP cid. Do not accept empty ids in searches to prevent this from happening.
This commit is contained in:
@@ -232,32 +232,38 @@ func (t *MediaTrack) ClearSubscriberNodes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *MediaTrack) HasSignalCid(cid string) bool {
|
func (t *MediaTrack) HasSignalCid(cid string) bool {
|
||||||
|
if cid != "" {
|
||||||
ti := t.MediaTrackReceiver.TrackInfoClone()
|
ti := t.MediaTrackReceiver.TrackInfoClone()
|
||||||
for _, c := range ti.Codecs {
|
for _, c := range ti.Codecs {
|
||||||
if c.Cid == cid {
|
if c.Cid == cid {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *MediaTrack) HasSdpCid(cid string) bool {
|
func (t *MediaTrack) HasSdpCid(cid string) bool {
|
||||||
|
if cid != "" {
|
||||||
ti := t.MediaTrackReceiver.TrackInfoClone()
|
ti := t.MediaTrackReceiver.TrackInfoClone()
|
||||||
for _, c := range ti.Codecs {
|
for _, c := range ti.Codecs {
|
||||||
if c.Cid == cid || c.SdpCid == cid {
|
if c.Cid == cid || c.SdpCid == cid {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *MediaTrack) GetMimeTypeForSdpCid(cid string) mime.MimeType {
|
func (t *MediaTrack) GetMimeTypeForSdpCid(cid string) mime.MimeType {
|
||||||
|
if cid != "" {
|
||||||
ti := t.MediaTrackReceiver.TrackInfoClone()
|
ti := t.MediaTrackReceiver.TrackInfoClone()
|
||||||
for _, c := range ti.Codecs {
|
for _, c := range ti.Codecs {
|
||||||
if c.Cid == cid || c.SdpCid == cid {
|
if c.Cid == cid || c.SdpCid == cid {
|
||||||
return mime.NormalizeMimeType(c.MimeType)
|
return mime.NormalizeMimeType(c.MimeType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return mime.MimeTypeUnknown
|
return mime.MimeTypeUnknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user