hls: fix race condition

This commit is contained in:
aler9 2021-11-01 11:07:37 +01:00
parent 5464f259a1
commit 47a975de09

View File

@ -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")
}