diff --git a/protocol/rtcp/client.go b/protocol/rtcp/client.go index 6717540f..534636cd 100644 --- a/protocol/rtcp/client.go +++ b/protocol/rtcp/client.go @@ -147,13 +147,9 @@ func (c *client) send() { // parse will read important statistics from sender reports. func (c *client) parse(buf []byte) { c.received() - msw, err := TimestampMSW(buf) + msw, lsw, err := Timestamp(buf) if err != nil { - c.ErrChan <- errors.New(fmt.Sprintf("could not get timestamp msw from sender report, failed with error: %v", err)) - } - lsw, err := TimestampLSW(buf) - if err != nil { - c.ErrChan <- errors.New(fmt.Sprintf("could not get timestamp lsw from sender report, failed with error: %v", err)) + c.ErrChan <- errors.New(fmt.Sprintf("could not get timestamp from sender report, failed with error: %v", err)) } c.setSenderTs(msw, lsw) } diff --git a/protocol/rtcp/rtcp.go b/protocol/rtcp/rtcp.go index 3dcc2d1e..f1da3409 100644 --- a/protocol/rtcp/rtcp.go +++ b/protocol/rtcp/rtcp.go @@ -6,6 +6,7 @@ import ( // RTCP packet types. const ( + typeSenderReport = 200 typeReceiverReport = 201 typeSourceDescription = 202 ) @@ -60,6 +61,16 @@ func (r *ReceiverReport) Bytes() []byte { return buf } +type ReportBlock struct { + SSRC uint32 // Source identifier. + FractionLost uint8 // Fraction of packets lost. + PacketsLost uint32 // Cumulative number of packets lost. + HighestSequence uint32 // Extended highest sequence number received. + Jitter uint32 // Interarrival jitter. + LSR uint32 // Last sender report timestamp. + DLSR uint32 // Delay since last sender report. +} + type SourceDescription struct { Header @@ -106,16 +117,6 @@ type Header struct { Type uint8 // Type of RTCP packet. } -type ReportBlock struct { - SSRC uint32 // Source identifier. - FractionLost uint8 // Fraction of packets lost. - PacketsLost uint32 // Cumulative number of packets lost. - HighestSequence uint32 // Extended highest sequence number received. - Jitter uint32 // Interarrival jitter. - LSR uint32 // Last sender report timestamp. - DLSR uint32 // Delay since last sender report. -} - type SDESItem struct { Type uint8 Text []byte @@ -146,11 +147,3 @@ func asByte(b bool) byte { } return 0x00 } - -func TimestampMSW(buf []byte) (uint32, error) { - return 0, nil -} - -func TimestampLSW(buf []byte) (uint32, error) { - return 0, nil -}