protocol/rtcp: improve ReportBlock field names

This commit is contained in:
Saxon 2019-04-23 14:30:05 +09:30
parent 4068aea207
commit 889072bde0
4 changed files with 32 additions and 33 deletions

View File

@ -174,13 +174,13 @@ func (c *Client) send() {
SenderSSRC: senderSSRC,
Blocks: []ReportBlock{
ReportBlock{
SSRC: c.sourceSSRC,
FractionLost: 0,
PacketsLost: math.MaxUint32,
HighestSequence: c.sequence(),
Jitter: c.jitter(),
LSR: c.lastSenderTs(),
DLSR: c.delay(),
SourceIdentifier: c.sourceSSRC,
FractionLost: 0,
PacketsLost: math.MaxUint32,
HighestSequence: c.sequence(),
Jitter: c.jitter(),
SenderReportTs: c.lastSenderTs(),
SenderReportDelay: c.delay(),
},
},
Extensions: nil,

View File

@ -69,13 +69,13 @@ func TestFormPayload(t *testing.T) {
SenderSSRC: 3605043418,
Blocks: []ReportBlock{
ReportBlock{
SSRC: 1873625286,
FractionLost: 0,
PacketsLost: math.MaxUint32,
HighestSequence: 99080,
Jitter: 32,
LSR: 3118540074,
DLSR: 11257,
SourceIdentifier: 1873625286,
FractionLost: 0,
PacketsLost: math.MaxUint32,
HighestSequence: 99080,
Jitter: 32,
SenderReportTs: 3118540074,
SenderReportDelay: 11257,
},
},
Extensions: nil,

View File

@ -39,12 +39,11 @@ const (
typeSourceDescription = 202
)
// SDES Item types.
// Source Description Item types.
const (
typeCName = 1
)
// MISC.
const (
reportBlockSize = 6
senderReportSize = 28
@ -71,13 +70,13 @@ func (r *ReceiverReport) Bytes(buf []byte) []byte {
idx := 8
for _, b := range r.Blocks {
binary.BigEndian.PutUint32(buf[idx:], b.SSRC)
binary.BigEndian.PutUint32(buf[idx:], b.SourceIdentifier)
binary.BigEndian.PutUint32(buf[idx+4:], b.PacketsLost)
buf[idx+4] = b.FractionLost
binary.BigEndian.PutUint32(buf[idx+8:], b.HighestSequence)
binary.BigEndian.PutUint32(buf[idx+12:], b.Jitter)
binary.BigEndian.PutUint32(buf[idx+16:], b.LSR)
binary.BigEndian.PutUint32(buf[idx+20:], b.DLSR)
binary.BigEndian.PutUint32(buf[idx+16:], b.SenderReportTs)
binary.BigEndian.PutUint32(buf[idx+20:], b.SenderReportDelay)
idx += 24
}
@ -91,13 +90,13 @@ func (r *ReceiverReport) Bytes(buf []byte) []byte {
// ReportBlock describes an RTCP report block used in Sender/Receiver Reports.
type ReportBlock struct {
SSRC uint32 // Source identifier.
FractionLost uint8 // Fraction of packets lost.
PacketsLost uint32 // Cumulative number of packets lost.
HighestSequence uint32 // Extended highest sequence number received.
Jitter uint32 // Interarrival jitter.
LSR uint32 // Last sender report timestamp.
DLSR uint32 // Delay since last sender report.
SourceIdentifier uint32 // Source identifier.
FractionLost uint8 // Fraction of packets lost.
PacketsLost uint32 // Cumulative number of packets lost.
HighestSequence uint32 // Extended highest sequence number received.
Jitter uint32 // Interarrival jitter.
SenderReportTs uint32 // Last sender report timestamp.
SenderReportDelay uint32 // Delay since last sender report.
}
// SourceDescription describes a source description RTCP packet.

View File

@ -57,13 +57,13 @@ func TestReceiverReportBytes(t *testing.T) {
SenderSSRC: 3605043418,
Blocks: []ReportBlock{
ReportBlock{
SSRC: 1873625286,
FractionLost: 0,
PacketsLost: math.MaxUint32,
HighestSequence: 99080,
Jitter: 32,
LSR: 3118540074,
DLSR: 11257,
SourceIdentifier: 1873625286,
FractionLost: 0,
PacketsLost: math.MaxUint32,
HighestSequence: 99080,
Jitter: 32,
SenderReportTs: 3118540074,
SenderReportDelay: 11257,
},
},
Extensions: nil,