mirror of
https://github.com/bluenviron/mediamtx
synced 2024-12-15 19:24:55 +00:00
hls: fix race condition
This commit is contained in:
parent
5464f259a1
commit
47a975de09
@ -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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user