protocol/rtcp: renamed SourceDescription to Description

This commit is contained in:
Saxon 2019-04-23 14:33:27 +09:30
parent 889072bde0
commit 4c2962ba75
4 changed files with 15 additions and 15 deletions

View File

@ -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

View File

@ -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{

View File

@ -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()

View File

@ -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{