fix: avoid deadlocks when participant closing, adapt to ion-sfu changes
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/livekit/protocol/utils"
|
||||||
"github.com/pion/ion-sfu/pkg/buffer"
|
"github.com/pion/ion-sfu/pkg/buffer"
|
||||||
"github.com/pion/ion-sfu/pkg/sfu"
|
"github.com/pion/ion-sfu/pkg/sfu"
|
||||||
"github.com/pion/ion-sfu/pkg/twcc"
|
"github.com/pion/ion-sfu/pkg/twcc"
|
||||||
@@ -12,8 +13,6 @@ import (
|
|||||||
"github.com/pion/webrtc/v3"
|
"github.com/pion/webrtc/v3"
|
||||||
"github.com/pion/webrtc/v3/pkg/rtcerr"
|
"github.com/pion/webrtc/v3/pkg/rtcerr"
|
||||||
|
|
||||||
"github.com/livekit/protocol/utils"
|
|
||||||
|
|
||||||
"github.com/livekit/livekit-server/pkg/config"
|
"github.com/livekit/livekit-server/pkg/config"
|
||||||
"github.com/livekit/livekit-server/pkg/logger"
|
"github.com/livekit/livekit-server/pkg/logger"
|
||||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||||
@@ -178,6 +177,7 @@ func (t *MediaTrack) AddSubscriber(sub types.Participant) error {
|
|||||||
|
|
||||||
t.params.Stats.SubSubscribedTrack(t.kind.String())
|
t.params.Stats.SubSubscribedTrack(t.kind.String())
|
||||||
|
|
||||||
|
go func() {
|
||||||
// ignore if the subscribing sub is not connected
|
// ignore if the subscribing sub is not connected
|
||||||
if sub.SubscriberPC().ConnectionState() == webrtc.PeerConnectionStateClosed {
|
if sub.SubscriberPC().ConnectionState() == webrtc.PeerConnectionStateClosed {
|
||||||
return
|
return
|
||||||
@@ -206,6 +206,7 @@ func (t *MediaTrack) AddSubscriber(sub types.Participant) error {
|
|||||||
|
|
||||||
sub.RemoveSubscribedTrack(t.params.ParticipantID, subTrack)
|
sub.RemoveSubscribedTrack(t.params.ParticipantID, subTrack)
|
||||||
sub.Negotiate()
|
sub.Negotiate()
|
||||||
|
}()
|
||||||
})
|
})
|
||||||
|
|
||||||
t.subscribedTracks[sub.ID()] = subTrack
|
t.subscribedTracks[sub.ID()] = subTrack
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ func createSingleNodeServer() *service.LivekitServer {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("could not create config: %v", err))
|
panic(fmt.Sprintf("could not create config: %v", err))
|
||||||
}
|
}
|
||||||
|
conf.Development = true
|
||||||
|
|
||||||
currentNode, err := routing.NewLocalNode(conf)
|
currentNode, err := routing.NewLocalNode(conf)
|
||||||
currentNode.Id = utils.NewGuid(nodeId1)
|
currentNode.Id = utils.NewGuid(nodeId1)
|
||||||
@@ -165,6 +166,7 @@ func createMultiNodeServer(nodeId string, port uint32) *service.LivekitServer {
|
|||||||
conf.RTC.UDPPort = port + 1
|
conf.RTC.UDPPort = port + 1
|
||||||
conf.RTC.TCPPort = port + 2
|
conf.RTC.TCPPort = port + 2
|
||||||
conf.Redis.Address = "localhost:6379"
|
conf.Redis.Address = "localhost:6379"
|
||||||
|
conf.Development = true
|
||||||
|
|
||||||
currentNode, err := routing.NewLocalNode(conf)
|
currentNode, err := routing.NewLocalNode(conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user