mirror of
https://github.com/livekit/livekit.git
synced 2026-05-15 20:25:37 +00:00
Update RTC config with congestion control config (#3262)
This commit is contained in:
+20
-1
@@ -15,6 +15,8 @@
|
||||
package rtc
|
||||
|
||||
import (
|
||||
"slices"
|
||||
|
||||
"github.com/pion/sdp/v3"
|
||||
"github.com/pion/webrtc/v4"
|
||||
|
||||
@@ -117,7 +119,7 @@ func NewWebRTCConfig(conf *config.Config) (*WebRTCConfig, error) {
|
||||
|
||||
// subscriber configuration
|
||||
subscriberConfig := DirectionConfig{
|
||||
StrictACKs: conf.RTC.StrictACKs,
|
||||
StrictACKs: rtcConf.StrictACKs,
|
||||
RTPHeaderExtension: RTPHeaderExtensionConfig{
|
||||
Video: []string{
|
||||
dd.ExtensionURI,
|
||||
@@ -154,6 +156,23 @@ func NewWebRTCConfig(conf *config.Config) (*WebRTCConfig, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *WebRTCConfig) UpdateCongestionControl(conf config.CongestionControlConfig) {
|
||||
c.Subscriber.RTPHeaderExtension.Video = slices.DeleteFunc(c.Subscriber.RTPHeaderExtension.Video, func(ext string) bool {
|
||||
return ext == sdp.TransportCCURI || ext == sdp.ABSSendTimeURI
|
||||
})
|
||||
c.Subscriber.RTCPFeedback.Video = slices.DeleteFunc(c.Subscriber.RTCPFeedback.Video, func(fb webrtc.RTCPFeedback) bool {
|
||||
return fb.Type == webrtc.TypeRTCPFBTransportCC || fb.Type == webrtc.TypeRTCPFBGoogREMB
|
||||
})
|
||||
|
||||
if conf.UseSendSideBWEInterceptor || conf.UseSendSideBWE {
|
||||
c.Subscriber.RTPHeaderExtension.Video = append(c.Subscriber.RTPHeaderExtension.Video, sdp.TransportCCURI)
|
||||
c.Subscriber.RTCPFeedback.Video = append(c.Subscriber.RTCPFeedback.Video, webrtc.RTCPFeedback{Type: webrtc.TypeRTCPFBTransportCC})
|
||||
} else {
|
||||
c.Subscriber.RTPHeaderExtension.Video = append(c.Subscriber.RTPHeaderExtension.Video, sdp.ABSSendTimeURI)
|
||||
c.Subscriber.RTCPFeedback.Video = append(c.Subscriber.RTCPFeedback.Video, webrtc.RTCPFeedback{Type: webrtc.TypeRTCPFBGoogREMB})
|
||||
}
|
||||
}
|
||||
|
||||
func (c *WebRTCConfig) SetBufferFactory(factory *buffer.Factory) {
|
||||
c.BufferFactory = factory
|
||||
c.SettingEngine.BufferFactory = factory.GetOrNew
|
||||
|
||||
Reference in New Issue
Block a user