Commit bf0e808
committed
ao/pulse: fix ao_drain hang when underrun makes buf_diff negative
With prebuf=0, PulseAudio documents that on underrun read_index overtakes
write_index, making buf_diff negative. Passing a negative int64_t to
pa_bytes_to_usec() (uint64_t) overflows and causes get_delay_hackfixed()
to return ~1e8 seconds, exceeding the 1000-day threshold in
mp_cond_timedwait() and making it call pthread_cond_wait() instead,
hanging ao_drain() forever. Observed on LoongArch + PulseAudio.
Fixes: 176511 parent 1a545fa commit bf0e808
1 file changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
587 | | - | |
588 | | - | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
589 | 597 | | |
590 | 598 | | |
591 | 599 | | |
| |||
0 commit comments