Skip to content

Commit

Permalink
Maybe fix participant test hang (#633)
Browse files Browse the repository at this point in the history
* explicitly subscribe to all participant tracks

* close if participant leaves before subscribe
  • Loading branch information
frostbyte73 authored Mar 12, 2024
1 parent 74b4d57 commit 9e29802
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions pkg/pipeline/source/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,30 @@ func (s *SDKSource) awaitParticipant(identity string) (uint32, uint32, error) {
return 0, 0, err
}

for trackCount := 0; trackCount == 0 || trackCount < len(rp.TrackPublications()); trackCount++ {
if err = <-s.errors; err != nil {
pubs := rp.TrackPublications()
for _, t := range pubs {
if err = s.subscribe(t); err != nil {
return 0, 0, err
}
}

for trackCount := 0; trackCount == 0 || trackCount < len(pubs); trackCount++ {
select {
case err = <-s.errors:
if err != nil {
return 0, 0, err
}
case <-s.endRecording:
return 0, 0, nil
}
}

var w, h uint32
for _, t := range rp.TrackPublications() {
for _, t := range pubs {
if t.TrackInfo().Type == livekit.TrackType_VIDEO {
w = t.TrackInfo().Width
h = t.TrackInfo().Height
}

}

s.initialized.Break()
Expand Down

0 comments on commit 9e29802

Please sign in to comment.