Skip to content

Commit

Permalink
fix claim is gone
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohan Totting committed Apr 13, 2024
1 parent bf8642c commit fb2511b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
13 changes: 2 additions & 11 deletions clienttrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,8 @@ func newClientTrack(c *Client, t *Track, isScreen bool) *clientTrack {
}

go func() {
clientCtx, clientCancel := context.WithCancel(c.Context())
defer func() {
clientCancel()
cancel()
}()
select {
case <-clientCtx.Done():
return
case <-ctx.Done():
return
}
defer cancel()
<-ctx.Done()
}()

return ct
Expand Down
7 changes: 4 additions & 3 deletions track.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ type ITrack interface {

type Track struct {
context context.Context
cancel context.CancelFunc
mu sync.Mutex
base baseTrack
remoteTrack *remoteTrack
Expand Down Expand Up @@ -143,10 +142,12 @@ func newTrack(ctx context.Context, client *Client, trackRemote IRemoteTrack, min

t.remoteTrack = newRemoteTrack(ctx, trackRemote, minWait, maxWait, pliInterval, onPLI, stats, onStatsUpdated, onRead, onNetworkConditionChanged)

t.context, t.cancel = context.WithCancel(t.remoteTrack.Context())
var cancel context.CancelFunc

t.context, cancel = context.WithCancel(t.remoteTrack.Context())

go func() {
defer t.cancel()
defer cancel()
<-t.context.Done()
}()

Expand Down

0 comments on commit fb2511b

Please sign in to comment.