protocol/rtcp: changed Timestamp func so that it returns msw and lsw

This commit is contained in:
Saxon 2019-04-13 19:48:20 +09:30
parent 757564a2ed
commit 5fa0969530
2 changed files with 13 additions and 24 deletions

View File

@ -147,13 +147,9 @@ func (c *client) send() {
// parse will read important statistics from sender reports. // parse will read important statistics from sender reports.
func (c *client) parse(buf []byte) { func (c *client) parse(buf []byte) {
c.received() c.received()
msw, err := TimestampMSW(buf) msw, lsw, err := Timestamp(buf)
if err != nil { if err != nil {
c.ErrChan <- errors.New(fmt.Sprintf("could not get timestamp msw 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))
}
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.setSenderTs(msw, lsw) c.setSenderTs(msw, lsw)
} }

View File

@ -6,6 +6,7 @@ import (
// RTCP packet types. // RTCP packet types.
const ( const (
typeSenderReport = 200
typeReceiverReport = 201 typeReceiverReport = 201
typeSourceDescription = 202 typeSourceDescription = 202
) )
@ -60,6 +61,16 @@ func (r *ReceiverReport) Bytes() []byte {
return buf 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 { type SourceDescription struct {
Header Header
@ -106,16 +117,6 @@ type Header struct {
Type uint8 // Type of RTCP packet. 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 SDESItem struct {
Type uint8 Type uint8
Text []byte Text []byte
@ -146,11 +147,3 @@ func asByte(b bool) byte {
} }
return 0x00 return 0x00
} }
func TimestampMSW(buf []byte) (uint32, error) {
return 0, nil
}
func TimestampLSW(buf []byte) (uint32, error) {
return 0, nil
}