From d7eeaecd29d4c8650de6c7d5e31ea841bc80303b Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Fri, 25 Oct 2024 17:23:15 -0400 Subject: [PATCH] Export min and max delay in header extension Exports the min and max delay attributes. --- playoutdelayextension.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/playoutdelayextension.go b/playoutdelayextension.go index 3882731..e8b9829 100644 --- a/playoutdelayextension.go +++ b/playoutdelayextension.go @@ -23,19 +23,19 @@ var errPlayoutDelayInvalidValue = errors.New("invalid playout delay value") // | ID | len=2 | MIN delay | MAX delay | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ type PlayoutDelayExtension struct { - minDelay, maxDelay uint16 + MinDelay, MaxDelay uint16 } // Marshal serializes the members to buffer func (p PlayoutDelayExtension) Marshal() ([]byte, error) { - if p.minDelay > playoutDelayMaxValue || p.maxDelay > playoutDelayMaxValue { + if p.MinDelay > playoutDelayMaxValue || p.MaxDelay > playoutDelayMaxValue { return nil, errPlayoutDelayInvalidValue } return []byte{ - byte(p.minDelay >> 4), - byte(p.minDelay<<4) | byte(p.maxDelay>>8), - byte(p.maxDelay), + byte(p.MinDelay >> 4), + byte(p.MinDelay<<4) | byte(p.MaxDelay>>8), + byte(p.MaxDelay), }, nil } @@ -44,7 +44,7 @@ func (p *PlayoutDelayExtension) Unmarshal(rawData []byte) error { if len(rawData) < playoutDelayExtensionSize { return errTooSmall } - p.minDelay = binary.BigEndian.Uint16(rawData[0:2]) >> 4 - p.maxDelay = binary.BigEndian.Uint16(rawData[1:3]) & 0x0FFF + p.MinDelay = binary.BigEndian.Uint16(rawData[0:2]) >> 4 + p.MaxDelay = binary.BigEndian.Uint16(rawData[1:3]) & 0x0FFF return nil }