mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-30 06:51:59 -08:00
hls: fix race condition
This commit is contained in:
parent
5464f259a1
commit
47a975de09
1 changed files with 2 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue