Source File
interceptor.go
Belonging Package
github.com/pion/interceptor
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MIT// Package interceptor contains the Interceptor interface, with some useful interceptors that should be safe to use// in most cases.package interceptorimport ()// Factory provides an interface for constructing interceptors.type Factory interface {NewInterceptor(id string) (Interceptor, error)}// Interceptor can be used to add functionality to you PeerConnections by modifying any incoming/outgoing rtp/rtcp// packets, or sending your own packets as needed.type Interceptor interface {// BindRTCPReader lets you modify any incoming RTCP packets. It is called once per sender/receiver, however this might// change in the future. The returned method will be called once per packet batch.BindRTCPReader(reader RTCPReader) RTCPReader// BindRTCPWriter lets you modify any outgoing RTCP packets. It is called once per PeerConnection. The returned method// will be called once per packet batch.BindRTCPWriter(writer RTCPWriter) RTCPWriter// BindLocalStream lets you modify any outgoing RTP packets. It is called once for per LocalStream. The returned method// will be called once per rtp packet.BindLocalStream(info *StreamInfo, writer RTPWriter) RTPWriter// UnbindLocalStream is called when the Stream is removed. It can be used to clean up any data related to that track.UnbindLocalStream(info *StreamInfo)// BindRemoteStream lets you modify any incoming RTP packets.// It is called once for per RemoteStream. The returned method// will be called once per rtp packet.BindRemoteStream(info *StreamInfo, reader RTPReader) RTPReader// UnbindRemoteStream is called when the Stream is removed. It can be used to clean up any data related to that track.UnbindRemoteStream(info *StreamInfo)io.Closer}// RTPWriter is used by Interceptor.BindLocalStream.type RTPWriter interface {// Write a rtp packetWrite(header *rtp.Header, payload []byte, attributes Attributes) (int, error)}// RTPReader is used by Interceptor.BindRemoteStream.type RTPReader interface {// Read a rtp packetRead([]byte, Attributes) (int, Attributes, error)}// RTCPWriter is used by Interceptor.BindRTCPWriter.type RTCPWriter interface {// Write a batch of rtcp packetsWrite(pkts []rtcp.Packet, attributes Attributes) (int, error)}// RTCPReader is used by Interceptor.BindRTCPReader.type RTCPReader interface {// Read a batch of rtcp packetsRead([]byte, Attributes) (int, Attributes, error)}// RTPWriterFunc is an adapter for RTPWrite interface.type RTPWriterFunc func(header *rtp.Header, payload []byte, attributes Attributes) (int, error)// RTPReaderFunc is an adapter for RTPReader interface.type RTPReaderFunc func([]byte, Attributes) (int, Attributes, error)// RTCPWriterFunc is an adapter for RTCPWriter interface.type RTCPWriterFunc func(pkts []rtcp.Packet, attributes Attributes) (int, error)// RTCPReaderFunc is an adapter for RTCPReader interface.type RTCPReaderFunc func([]byte, Attributes) (int, Attributes, error)// Write a rtp packet.func ( RTPWriterFunc) ( *rtp.Header, []byte, Attributes) (int, error) {return (, , )}// Read a rtp packet.func ( RTPReaderFunc) ( []byte, Attributes) (int, Attributes, error) {return (, )}// Write a batch of rtcp packets.func ( RTCPWriterFunc) ( []rtcp.Packet, Attributes) (int, error) {return (, )}// Read a batch of rtcp packets.func ( RTCPReaderFunc) ( []byte, Attributes) (int, Attributes, error) {return (, )}
![]() |
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. |