From 22d71f8a57780f9026c381ad29af53db78c1a13d Mon Sep 17 00:00:00 2001 From: Saxon Date: Wed, 10 Apr 2019 17:12:00 +0930 Subject: [PATCH] protocol/rtcp: fixed writing of SenderSSRC in ReceiverReport header, now test passing. --- protocol/rtcp/rtcp.go | 2 +- protocol/rtcp/rtcp_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/protocol/rtcp/rtcp.go b/protocol/rtcp/rtcp.go index aedb57e7..1c9892bb 100644 --- a/protocol/rtcp/rtcp.go +++ b/protocol/rtcp/rtcp.go @@ -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[1] = h.Type binary.BigEndian.PutUint16(buf[2:], uint16(l)) - buf[4] = byte(h.SenderSSRC) + binary.BigEndian.PutUint32(buf[4:], h.SenderSSRC) } func asByte(b bool) byte { diff --git a/protocol/rtcp/rtcp_test.go b/protocol/rtcp/rtcp_test.go index 17ed8c5a..31588e53 100644 --- a/protocol/rtcp/rtcp_test.go +++ b/protocol/rtcp/rtcp_test.go @@ -41,6 +41,8 @@ func TestReceiverReportBytes(t *testing.T) { } got := report.Bytes() + t.Logf("Got: %v\n", got) + t.Logf("Want: %v\n", expect) if !bytes.Equal(got, expect) { t.Errorf("did not get expected result. \nGot: %v\nWant: %v\n", got, expect) }