diff --git a/internal/hls/client.go b/internal/hls/client.go index 42b13d3a..2f6c45f2 100644 --- a/internal/hls/client.go +++ b/internal/hls/client.go @@ -100,10 +100,11 @@ func (q *clientSegmentQueue) waitAndPull(ctx context.Context) ([]byte, error) { q.mutex.Lock() for len(q.queue) == 0 { + didPush := q.didPush q.mutex.Unlock() select { - case <-q.didPush: + case <-didPush: case <-ctx.Done(): return nil, fmt.Errorf("terminated") }