Source File
playoutdelayextension.go
Belonging Package
github.com/pion/rtp
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage rtpimport ()const (playoutDelayExtensionSize = 3playoutDelayMaxValue = (1 << 12) - 1)var errPlayoutDelayInvalidValue = errors.New("invalid playout delay value")// PlayoutDelayExtension is a extension payload format in// http://www.webrtc.org/experiments/rtp-hdrext/playout-delay// 0 1 2 3// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+// | ID | len=2 | MIN delay | MAX delay |// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+// .type PlayoutDelayExtension struct {MinDelay, MaxDelay uint16}// Marshal serializes the members to buffer.func ( PlayoutDelayExtension) () ([]byte, error) {if .MinDelay > playoutDelayMaxValue || .MaxDelay > playoutDelayMaxValue {return nil, errPlayoutDelayInvalidValue}return []byte{byte(.MinDelay >> 4),byte(.MinDelay<<4) | byte(.MaxDelay>>8),byte(.MaxDelay),}, nil}// Unmarshal parses the passed byte slice and stores the result in the members.func ( *PlayoutDelayExtension) ( []byte) error {if len() < playoutDelayExtensionSize {return errTooSmall}.MinDelay = binary.BigEndian.Uint16([0:2]) >> 4.MaxDelay = binary.BigEndian.Uint16([1:3]) & 0x0FFFreturn nil}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |