Skip to content

Commit

Permalink
dont wait for expected participant tracks (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 authored Jun 26, 2024
1 parent 64191f0 commit 9392737
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pkg/pipeline/source/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ func (s *SDKSource) awaitParticipantTracks(identity string) (uint32, uint32, err
return 0, 0, err
}

// await expected subscriptions
subscribed := 0
pubs := rp.TrackPublications()
expected := 0
for _, pub := range pubs {
Expand All @@ -217,13 +219,23 @@ func (s *SDKSource) awaitParticipantTracks(identity string) (uint32, uint32, err
}
}

// await all expected subscriptions
for trackCount := 0; trackCount < expected; trackCount++ {
deadline := make(chan struct{})
time.AfterFunc(time.Second*3, func() {
close(deadline)
})
done := false
for !done {
select {
case err = <-s.errors:
if err != nil {
return 0, 0, err
}
subscribed++
if subscribed == expected {
done = true
}
case <-deadline:
done = true
}
}

Expand Down

0 comments on commit 9392737

Please sign in to comment.