mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00
Add helper to configure CCFB (defined in RFC 8888)
Adds a helper function to register an interceptor that produces congestion control feedback as defined in RFC 8888 (https://datatracker.ietf.org/doc/rfc8888/).
This commit is contained in:

committed by
Sean DuBois

parent
66f0c402c1
commit
7e598b5a63
@@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/pion/interceptor"
|
"github.com/pion/interceptor"
|
||||||
"github.com/pion/interceptor/pkg/nack"
|
"github.com/pion/interceptor/pkg/nack"
|
||||||
"github.com/pion/interceptor/pkg/report"
|
"github.com/pion/interceptor/pkg/report"
|
||||||
|
"github.com/pion/interceptor/pkg/rfc8888"
|
||||||
"github.com/pion/interceptor/pkg/twcc"
|
"github.com/pion/interceptor/pkg/twcc"
|
||||||
"github.com/pion/rtp"
|
"github.com/pion/rtp"
|
||||||
"github.com/pion/sdp/v3"
|
"github.com/pion/sdp/v3"
|
||||||
@@ -109,6 +110,19 @@ func ConfigureTWCCSender(mediaEngine *MediaEngine, interceptorRegistry *intercep
|
|||||||
return nil
|
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 }
|
type interceptorToTrackLocalWriter struct{ interceptor atomic.Value } // interceptor.RTPWriter }
|
||||||
|
|
||||||
func (i *interceptorToTrackLocalWriter) WriteRTP(header *rtp.Header, payload []byte) (int, error) {
|
func (i *interceptorToTrackLocalWriter) WriteRTP(header *rtp.Header, payload []byte) (int, error) {
|
||||||
|
Reference in New Issue
Block a user