From 4c2962ba75ff48dd25a7b3fb0c6a76b8fcd9c6e6 Mon Sep 17 00:00:00 2001 From: Saxon Date: Tue, 23 Apr 2019 14:33:27 +0930 Subject: [PATCH] protocol/rtcp: renamed SourceDescription to Description --- protocol/rtcp/client.go | 6 +++--- protocol/rtcp/client_test.go | 4 ++-- protocol/rtcp/rtcp.go | 16 ++++++++-------- protocol/rtcp/rtcp_test.go | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/protocol/rtcp/client.go b/protocol/rtcp/client.go index c32696f1..74fb9c8d 100644 --- a/protocol/rtcp/client.go +++ b/protocol/rtcp/client.go @@ -186,12 +186,12 @@ func (c *Client) send() { Extensions: nil, } - description := SourceDescription{ + description := Description{ Header: Header{ Version: rtcpVer, Padding: false, ReportCount: 1, - Type: typeSourceDescription, + Type: typeDescription, }, Chunks: []Chunk{ Chunk{ @@ -218,7 +218,7 @@ func (c *Client) send() { // formPayload takes a pointer to a ReceiverReport and a pointer to a // Source Description and calls Bytes on both, writing to the underlying Client // buf. A slice to the combined writtem memory is returned. -func (c *Client) formPayload(r *ReceiverReport, d *SourceDescription) []byte { +func (c *Client) formPayload(r *ReceiverReport, d *Description) []byte { rl := len(r.Bytes(c.buf[:])) dl := len(d.Bytes(c.buf[rl:])) t := rl + dl diff --git a/protocol/rtcp/client_test.go b/protocol/rtcp/client_test.go index db515c16..2f8ce5ce 100644 --- a/protocol/rtcp/client_test.go +++ b/protocol/rtcp/client_test.go @@ -81,12 +81,12 @@ func TestFormPayload(t *testing.T) { Extensions: nil, } - description := SourceDescription{ + description := Description{ Header: Header{ Version: 2, Padding: false, ReportCount: 1, - Type: typeSourceDescription, + Type: typeDescription, }, Chunks: []Chunk{ Chunk{ diff --git a/protocol/rtcp/rtcp.go b/protocol/rtcp/rtcp.go index 0e74d08f..afde21fc 100644 --- a/protocol/rtcp/rtcp.go +++ b/protocol/rtcp/rtcp.go @@ -34,9 +34,9 @@ import ( // RTCP packet types. const ( - typeSenderReport = 200 - typeReceiverReport = 201 - typeSourceDescription = 202 + typeSenderReport = 200 + typeReceiverReport = 201 + typeDescription = 202 ) // Source Description Item types. @@ -99,14 +99,14 @@ type ReportBlock struct { SenderReportDelay uint32 // Delay since last sender report. } -// SourceDescription describes a source description RTCP packet. -type SourceDescription struct { +// Description describes a source description RTCP packet. +type Description struct { Header // Standard RTCP packet header. Chunks []Chunk // Chunks to describe items of each SSRC. } -// Bytes returns an []byte of the SourceDescription d. -func (d *SourceDescription) Bytes(buf []byte) []byte { +// Bytes returns an []byte of the Description d. +func (d *Description) Bytes(buf []byte) []byte { bodyLen := d.bodyLen() rem := bodyLen % 4 if rem != 0 { @@ -136,7 +136,7 @@ func (d *SourceDescription) Bytes(buf []byte) []byte { } // bodyLen calculates the body length of a source description packet in bytes. -func (d *SourceDescription) bodyLen() int { +func (d *Description) bodyLen() int { var l int for _, c := range d.Chunks { l += c.len() diff --git a/protocol/rtcp/rtcp_test.go b/protocol/rtcp/rtcp_test.go index 4eb458ce..a75a750d 100644 --- a/protocol/rtcp/rtcp_test.go +++ b/protocol/rtcp/rtcp_test.go @@ -88,12 +88,12 @@ func TestSourceDescriptionBytes(t *testing.T) { 0x70, 0x63, 0x00, 0x00, } - description := SourceDescription{ + description := Description{ Header: Header{ Version: 2, Padding: false, ReportCount: 1, - Type: typeSourceDescription, + Type: typeDescription, }, Chunks: []Chunk{ Chunk{