Panic fixes (#3270)
Also, do negotiated down track extensions after bind.
This commit is contained in:
@@ -158,6 +158,10 @@ func NewWebRTCConfig(conf *config.Config) (*WebRTCConfig, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *WebRTCConfig) UpdateCongestionControl(conf config.CongestionControlConfig) {
|
func (c *WebRTCConfig) UpdateCongestionControl(conf config.CongestionControlConfig) {
|
||||||
|
if c.Subscriber.RTPHeaderExtension.Video == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
c.Subscriber.RTPHeaderExtension.Video = slices.DeleteFunc(c.Subscriber.RTPHeaderExtension.Video, func(ext string) bool {
|
c.Subscriber.RTPHeaderExtension.Video = slices.DeleteFunc(c.Subscriber.RTPHeaderExtension.Video, func(ext string) bool {
|
||||||
return ext == sdp.TransportCCURI || ext == sdp.ABSSendTimeURI
|
return ext == sdp.TransportCCURI || ext == sdp.ABSSendTimeURI
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import (
|
|||||||
"github.com/pion/rtp/codecs"
|
"github.com/pion/rtp/codecs"
|
||||||
)
|
)
|
||||||
|
|
||||||
var minFramesForCalculation = [...]int{8, 15, 40}
|
var minFramesForCalculation = [...]int{8, 15, 40, 60}
|
||||||
|
|
||||||
type frameInfo struct {
|
type frameInfo struct {
|
||||||
seq uint16
|
seq uint16
|
||||||
|
|||||||
+11
-11
@@ -459,17 +459,6 @@ func (d *DownTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters,
|
|||||||
return codec, nil
|
return codec, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind is called under RTPSender.mu lock, call the RTPSender.GetParameters in goroutine to avoid deadlock
|
|
||||||
go func() {
|
|
||||||
if tr := d.transceiver.Load(); tr != nil {
|
|
||||||
if sender := tr.Sender(); sender != nil {
|
|
||||||
extensions := sender.GetParameters().HeaderExtensions
|
|
||||||
d.params.Logger.Debugw("negotiated downtrack extensions", "extensions", extensions)
|
|
||||||
d.SetRTPHeaderExtensions(extensions)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
doBind := func() {
|
doBind := func() {
|
||||||
d.bindLock.Lock()
|
d.bindLock.Lock()
|
||||||
if d.IsClosed() {
|
if d.IsClosed() {
|
||||||
@@ -566,6 +555,17 @@ func (d *DownTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters,
|
|||||||
d.forwarder.DetermineCodec(codec.RTPCodecCapability, d.params.Receiver.HeaderExtensions())
|
d.forwarder.DetermineCodec(codec.RTPCodecCapability, d.params.Receiver.HeaderExtensions())
|
||||||
d.connectionStats.Start(codec.MimeType, isFECEnabled)
|
d.connectionStats.Start(codec.MimeType, isFECEnabled)
|
||||||
d.params.Logger.Debugw("downtrack bound")
|
d.params.Logger.Debugw("downtrack bound")
|
||||||
|
|
||||||
|
// Bind is called under RTPSender.mu lock, call the RTPSender.GetParameters in goroutine to avoid deadlock
|
||||||
|
go func() {
|
||||||
|
if tr := d.transceiver.Load(); tr != nil {
|
||||||
|
if sender := tr.Sender(); sender != nil {
|
||||||
|
extensions := sender.GetParameters().HeaderExtensions
|
||||||
|
d.params.Logger.Debugw("negotiated downtrack extensions", "extensions", extensions)
|
||||||
|
d.SetRTPHeaderExtensions(extensions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
isReceiverReady := d.isReceiverReady
|
isReceiverReady := d.isReceiverReady
|
||||||
|
|||||||
Reference in New Issue
Block a user