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, SenderSSRC: senderSSRC,
Blocks: []ReportBlock{ Blocks: []ReportBlock{
ReportBlock{ ReportBlock{
SSRC: c.sourceSSRC, SourceIdentifier: c.sourceSSRC,
FractionLost: 0, FractionLost: 0,
PacketsLost: math.MaxUint32, PacketsLost: math.MaxUint32,
HighestSequence: c.sequence(), HighestSequence: c.sequence(),
Jitter: c.jitter(), Jitter: c.jitter(),
LSR: c.lastSenderTs(), SenderReportTs: c.lastSenderTs(),
DLSR: c.delay(), SenderReportDelay: c.delay(),
}, },
}, },
Extensions: nil, Extensions: nil,

View File

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

View File

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

View File

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