From baad2da0ddeaa65b62f8b4ec9fbef9ed52bb13b7 Mon Sep 17 00:00:00 2001 From: Mathis Engelbart <mathis.engelbart@gmail.com> Date: Thu, 16 Dec 2021 10:37:15 +0100 Subject: [PATCH] Make pacer configurable --- pkg/gcc/interceptor.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/gcc/interceptor.go b/pkg/gcc/interceptor.go index eeee5ca3..1127410c 100644 --- a/pkg/gcc/interceptor.go +++ b/pkg/gcc/interceptor.go @@ -29,6 +29,13 @@ func InitialBitrate(rate int) Option { } } +func SetPacer(pacer Pacer) Option { + return func(g *Interceptor) error { + g.pacer = pacer + return nil + } +} + // InterceptorFactory is a factory for GCC interceptors type InterceptorFactory struct { opts []Option @@ -68,8 +75,10 @@ func (f *InterceptorFactory) NewInterceptor(id string) (interceptor.Interceptor, } } + if i.pacer == nil { + i.pacer = NewLeakyBucketPacer(i.bitrate) + } i.FeedbackAdapter = NewFeedbackAdapter() - i.pacer = NewLeakyBucketPacer(i.bitrate) i.loss = newLossBasedBWE(i.bitrate) i.delay = newDelayBasedBWE(i.bitrate)