Persist participant before firing webhook (#1340)

Fixes #1339
This commit is contained in:
David Zhao
2023-01-27 19:29:38 -08:00
committed by GitHub
parent d83f9fe68b
commit db40272657
4 changed files with 19 additions and 25 deletions
+1 -2
View File
@@ -75,7 +75,7 @@ func (p *ParticipantSupervisor) SetPublisherPeerConnectionConnected(isConnected
p.lock.Unlock()
}
func (p *ParticipantSupervisor) AddPublication(trackID livekit.TrackID, onSuccess func(track types.LocalMediaTrack)) {
func (p *ParticipantSupervisor) AddPublication(trackID livekit.TrackID) {
p.lock.Lock()
pm, ok := p.publications[trackID]
if !ok {
@@ -85,7 +85,6 @@ func (p *ParticipantSupervisor) AddPublication(trackID livekit.TrackID, onSucces
TrackID: trackID,
IsPeerConnectionConnected: p.isPublisherConnected,
Logger: p.params.Logger,
OnSuccess: onSuccess,
},
),
}
@@ -28,7 +28,6 @@ type PublicationMonitorParams struct {
TrackID livekit.TrackID
IsPeerConnectionConnected bool
Logger logger.Logger
OnSuccess func(t types.LocalMediaTrack)
}
type PublicationMonitor struct {
@@ -168,12 +167,6 @@ func (p *PublicationMonitor) update() {
return
}
if pub.isStart && p.publishedTrack != nil {
if p.params.OnSuccess != nil {
p.params.OnSuccess(p.publishedTrack)
}
}
if (pub.isStart && p.publishedTrack == nil) || (!pub.isStart && p.publishedTrack != nil) {
// put it back as the condition is not satisfied
p.desiredPublishes.PushFront(pub)