protocol/rtcp: fixed writing of SenderSSRC in ReceiverReport header, now test passing.

This commit is contained in:
Saxon 2019-04-10 17:12:00 +09:30
parent 956110f0ef
commit 22d71f8a57
2 changed files with 3 additions and 1 deletions

View File

@ -129,7 +129,7 @@ func (h Header) writeHeader(buf []byte, l int) {
buf[0] = h.Version<<6 | asByte(h.Padding)<<5 | 0x1f&h.ReportCount buf[0] = h.Version<<6 | asByte(h.Padding)<<5 | 0x1f&h.ReportCount
buf[1] = h.Type buf[1] = h.Type
binary.BigEndian.PutUint16(buf[2:], uint16(l)) binary.BigEndian.PutUint16(buf[2:], uint16(l))
buf[4] = byte(h.SenderSSRC) binary.BigEndian.PutUint32(buf[4:], h.SenderSSRC)
} }
func asByte(b bool) byte { func asByte(b bool) byte {

View File

@ -41,6 +41,8 @@ func TestReceiverReportBytes(t *testing.T) {
} }
got := report.Bytes() got := report.Bytes()
t.Logf("Got: %v\n", got)
t.Logf("Want: %v\n", expect)
if !bytes.Equal(got, expect) { if !bytes.Equal(got, expect) {
t.Errorf("did not get expected result. \nGot: %v\nWant: %v\n", got, expect) t.Errorf("did not get expected result. \nGot: %v\nWant: %v\n", got, expect)
} }