// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage interceptor// Chain is an interceptor that runs all child interceptors in order.typeChainstruct { interceptors []Interceptor}// NewChain returns a new Chain interceptor.func ( []Interceptor) *Chain {return &Chain{interceptors: }}// 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.func ( *Chain) ( RTCPReader) RTCPReader {for , := range .interceptors { = .BindRTCPReader() }return}// BindRTCPWriter lets you modify any outgoing RTCP packets. It is called once per PeerConnection. The returned method// will be called once per packet batch.func ( *Chain) ( RTCPWriter) RTCPWriter {for , := range .interceptors { = .BindRTCPWriter() }return}// 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.func ( *Chain) ( *StreamInfo, RTPWriter) RTPWriter {for , := range .interceptors { = .BindLocalStream(, ) }return}// UnbindLocalStream is called when the Stream is removed. It can be used to clean up any data related to that track.func ( *Chain) ( *StreamInfo) {for , := range .interceptors { .UnbindLocalStream() }}// 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.func ( *Chain) ( *StreamInfo, RTPReader) RTPReader {for , := range .interceptors { = .BindRemoteStream(, ) }return}// UnbindRemoteStream is called when the Stream is removed. It can be used to clean up any data related to that track.func ( *Chain) ( *StreamInfo) {for , := range .interceptors { .UnbindRemoteStream() }}// Close closes the Interceptor, cleaning up any data if necessary.func ( *Chain) () error {var []errorfor , := range .interceptors { = append(, .Close()) }returnflattenErrs()}
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.