// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage interceptorimport ()type unmarshaledDataKeyType intconst ( rtpHeaderKey unmarshaledDataKeyType = iota rtcpPacketsKey)var errInvalidType = errors.New("found value of invalid type in attributes map")// Attributes are a generic key/value store used by interceptors.typeAttributesmap[interface{}]interface{}// Get returns the attribute associated with key.func ( Attributes) ( interface{}) interface{} {return []}// Set sets the attribute associated with key to the given value.func ( Attributes) ( interface{}, interface{}) { [] = }// GetRTPHeader gets the RTP header if present. If it is not present, it will be// unmarshalled from the raw byte slice and stored in the attributes.func ( Attributes) ( []byte) (*rtp.Header, error) {if , := [rtpHeaderKey]; {if , := .(*rtp.Header); {return , nil }returnnil, errInvalidType } := &rtp.Header{}if , := .Unmarshal(); != nil {returnnil, } [rtpHeaderKey] = return , nil}// GetRTCPPackets gets the RTCP packets if present. If the packet slice is not// present, it will be unmarshalled from the raw byte slice and stored in the// attributes.func ( Attributes) ( []byte) ([]rtcp.Packet, error) {if , := [rtcpPacketsKey]; {if , := .([]rtcp.Packet); {return , nil }returnnil, errInvalidType } , := rtcp.Unmarshal()if != nil {returnnil, } [rtcpPacketsKey] = return , nil}
The pages are generated with Goldsv0.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.