initialize bucket size by publish bitrates (#2763)
This commit is contained in:
@@ -194,7 +194,7 @@ func (b *Buffer) SetAudioLossProxying(enable bool) {
|
||||
b.enableAudioLossProxying = enable
|
||||
}
|
||||
|
||||
func (b *Buffer) Bind(params webrtc.RTPParameters, codec webrtc.RTPCodecCapability) {
|
||||
func (b *Buffer) Bind(params webrtc.RTPParameters, codec webrtc.RTPCodecCapability, bitrates int) {
|
||||
b.Lock()
|
||||
defer b.Unlock()
|
||||
if b.bound {
|
||||
@@ -264,6 +264,14 @@ func (b *Buffer) Bind(params webrtc.RTPParameters, codec webrtc.RTPCodecCapabili
|
||||
}
|
||||
}
|
||||
}
|
||||
if bitrates > 0 {
|
||||
pps := bitrates / 8 / 1200
|
||||
for pps > b.bucket.Capacity() {
|
||||
if b.bucket.Grow() >= b.maxVideoPkts {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
b.codecType = webrtc.RTPCodecType(0)
|
||||
|
||||
Reference in New Issue
Block a user