client: allow to publish tracks with pre-existing control attribute (#48)

This commit is contained in:
aler9
2021-06-23 22:03:22 +02:00
parent a585634532
commit d073a185c2
6 changed files with 274 additions and 203 deletions

View File

@@ -1090,14 +1090,17 @@ func (cc *ClientConn) doAnnounce(u *base.URL, tracks Tracks) (*base.Response, er
// (tested with ffmpeg and gstreamer)
baseURL := u.Clone()
// set id, base url and control attribute on tracks
// set ID, base URL, control attribute of tracks
for i, t := range tracks {
t.ID = i
t.BaseURL = baseURL
t.Media.Attributes = append(t.Media.Attributes, psdp.Attribute{
Key: "control",
Value: "trackID=" + strconv.FormatInt(int64(i), 10),
})
if !t.hasControlAttribute() {
t.Media.Attributes = append(t.Media.Attributes, psdp.Attribute{
Key: "control",
Value: "trackID=" + strconv.FormatInt(int64(i), 10),
})
}
}
res, err := cc.do(&base.Request{