Skip to content

Commit f46a225

Browse files
committed
Add Estimator accessor to cc.Interceptor
Currently, the congestion control interceptor communicates the estimator to the application by using a callback, even though creating the interceptor is synchronous operation. Allow applications to avoid the callback by adding a public accessor.
1 parent a531522 commit f46a225

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/cc/interceptor.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func NewInterceptor(factory BandwidthEstimatorFactory, opts ...Option) (*Interce
5656

5757
// OnNewPeerConnection sets a callback that is called when a new CC interceptor
5858
// is created.
59+
// Deprecated: use [Estimator] instead.
5960
func (f *InterceptorFactory) OnNewPeerConnection(cb NewPeerConnectionCallback) {
6061
f.addPeerConnection = cb
6162
}
@@ -132,3 +133,7 @@ func (c *Interceptor) BindLocalStream(info *interceptor.StreamInfo, writer inter
132133
func (c *Interceptor) Close() error {
133134
return c.estimator.Close()
134135
}
136+
137+
func (c *Interceptor) Estimator() BandwidthEstimator {
138+
return c.estimator
139+
}

0 commit comments

Comments
 (0)