Add max playout delay config (#2089)

* Add max playout delay

* config sample
This commit is contained in:
cnderrauber
2023-09-19 11:30:38 +08:00
committed by GitHub
parent 8a0d417a8c
commit e46da0705a
6 changed files with 16 additions and 4 deletions
+8 -2
View File
@@ -326,14 +326,20 @@ func NewDownTrack(params DowntrackParams) (*DownTrack, error) {
})
// set initial playout delay to minimum value
if d.params.PlayoutDelayLimit.GetEnabled() && d.params.PlayoutDelayLimit.GetMin() > 0 {
if d.params.PlayoutDelayLimit.GetEnabled() {
maxDelay := uint32(rtpextension.PlayoutDelayDefaultMax)
if d.params.PlayoutDelayLimit.GetMax() > 0 {
maxDelay = d.params.PlayoutDelayLimit.GetMax()
}
delay := rtpextension.PlayoutDelayFromValue(
uint16(d.params.PlayoutDelayLimit.GetMin()),
rtpextension.PlayoutDelayDefaultMax,
uint16(maxDelay),
)
b, err := delay.Marshal()
if err == nil {
d.playoutDelayBytes.Store(b)
} else {
d.params.Logger.Errorw("failed to marshal playout delay", err, "playoutDelay", d.params.PlayoutDelayLimit)
}
}
if d.kind == webrtc.RTPCodecTypeVideo {