Skip to content

Commit

Permalink
Make pacer configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
mengelbart committed Dec 16, 2021
1 parent b559316 commit baad2da
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/gcc/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit baad2da

Please sign in to comment.