- fix truncation to seconds of RTP time in RTP-Info
- add a small quantity to rtptime in RTP-Info
- add 1 to last sequence number in RTP-Info
This commit is contained in:
aler9
2022-05-14 10:37:50 +02:00
parent 3bd8ad810f
commit 206506a8f0
3 changed files with 48 additions and 33 deletions

View File

@@ -881,18 +881,21 @@ func (ss *ServerSession) handleRequest(sc *ServerConn, req *base.Request) (*base
ss.setuppedStream.readerSetActive(ss)
// add RTP-Info
var trackIDs []int
for trackID := range ss.setuppedTracks {
trackIDs = append(trackIDs, trackID)
}
sort.Slice(trackIDs, func(a, b int) bool {
return trackIDs[a] < trackIDs[b]
})
var ri headers.RTPInfo
now := time.Now()
for _, trackID := range trackIDs {
ts := ss.setuppedStream.timestamp(trackID)
if ts == 0 {
seqNum, ts, ok := ss.setuppedStream.rtpInfo(trackID, now)
if !ok {
continue
}
@@ -903,11 +906,9 @@ func (ss *ServerSession) handleRequest(sc *ServerConn, req *base.Request) (*base
Path: "/" + *ss.setuppedPath + "/trackID=" + strconv.FormatInt(int64(trackID), 10),
}
lsn := ss.setuppedStream.lastSequenceNumber(trackID)
ri = append(ri, &headers.RTPInfoEntry{
URL: u.String(),
SequenceNumber: &lsn,
SequenceNumber: &seqNum,
Timestamp: &ts,
})
}