Skip to content

Commit

Permalink
Add helper to configure CCFB (defined in RFC 8888)
Browse files Browse the repository at this point in the history
Adds a helper function to register an interceptor that produces
congestion control feedback as defined in RFC 8888
(https://datatracker.ietf.org/doc/rfc8888/).
  • Loading branch information
mengelbart authored and Sean-Der committed Sep 12, 2023
1 parent 66f0c40 commit 7e598b5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/pion/interceptor"
"github.com/pion/interceptor/pkg/nack"
"github.com/pion/interceptor/pkg/report"
"github.com/pion/interceptor/pkg/rfc8888"
"github.com/pion/interceptor/pkg/twcc"
"github.com/pion/rtp"
"github.com/pion/sdp/v3"
Expand Down Expand Up @@ -109,6 +110,19 @@ func ConfigureTWCCSender(mediaEngine *MediaEngine, interceptorRegistry *intercep
return nil
}

// ConfigureCongestionControlFeedback registers congestion control feedback as
// defined in RFC 8888 (https://datatracker.ietf.org/doc/rfc8888/)
func ConfigureCongestionControlFeedback(mediaEngine *MediaEngine, interceptorRegistry *interceptor.Registry) error {
mediaEngine.RegisterFeedback(RTCPFeedback{Type: TypeRTCPFBACK, Parameter: "ccfb"}, RTPCodecTypeVideo)
mediaEngine.RegisterFeedback(RTCPFeedback{Type: TypeRTCPFBACK, Parameter: "ccfb"}, RTPCodecTypeAudio)
generator, err := rfc8888.NewSenderInterceptor()
if err != nil {
return err
}
interceptorRegistry.Add(generator)
return nil
}

type interceptorToTrackLocalWriter struct{ interceptor atomic.Value } // interceptor.RTPWriter }

func (i *interceptorToTrackLocalWriter) WriteRTP(header *rtp.Header, payload []byte) (int, error) {
Expand Down

0 comments on commit 7e598b5

Please sign in to comment.