2019-04-10 10:03:12 +03:00
|
|
|
package rtcp
|
|
|
|
|
2019-04-10 10:24:01 +03:00
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"math"
|
|
|
|
"testing"
|
|
|
|
)
|
2019-04-10 10:03:12 +03:00
|
|
|
|
|
|
|
func TestReceiverReportBytes(t *testing.T) {
|
2019-04-10 10:24:01 +03:00
|
|
|
expect := []byte{
|
|
|
|
0x81, 0xc9, 0x00, 0x07,
|
|
|
|
0xd6, 0xe0, 0x98, 0xda,
|
|
|
|
0x6f, 0xad, 0x40, 0xc6,
|
|
|
|
0x00, 0xff, 0xff, 0xff,
|
|
|
|
0x00, 0x01, 0x83, 0x08,
|
|
|
|
0x00, 0x00, 0x00, 0x20,
|
|
|
|
0xb9, 0xe1, 0x25, 0x2a,
|
|
|
|
0x00, 0x00, 0x2b, 0xf9,
|
|
|
|
}
|
2019-04-10 10:03:12 +03:00
|
|
|
|
2019-04-10 10:24:01 +03:00
|
|
|
report := ReceiverReport{
|
|
|
|
Header: Header{
|
|
|
|
Version: 2,
|
|
|
|
Padding: false,
|
|
|
|
ReportCount: 1,
|
|
|
|
Type: typeReceiverReport,
|
|
|
|
SenderSSRC: 3605043418,
|
|
|
|
},
|
|
|
|
Blocks: []ReportBlock{
|
|
|
|
ReportBlock{
|
|
|
|
SSRC: 1873625286,
|
|
|
|
FractionLost: 0,
|
|
|
|
PacketsLost: math.MaxUint32,
|
|
|
|
HighestSequence: 99080,
|
|
|
|
Jitter: 32,
|
|
|
|
LSR: 3118540074,
|
|
|
|
DLSR: 11257,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Extensions: nil,
|
|
|
|
}
|
|
|
|
|
|
|
|
got := report.Bytes()
|
|
|
|
if !bytes.Equal(got, expect) {
|
|
|
|
t.Errorf("did not get expected result. \nGot: %v\nWant: %v\n", got, expect)
|
|
|
|
}
|
2019-04-10 10:03:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestSourceDescriptionBytes(t *testing.T) {
|
|
|
|
|
|
|
|
}
|