ao/pulse: fix ao_drain hang when underrun makes buf_diff negative#17652
ao/pulse: fix ao_drain hang when underrun makes buf_diff negative#17652dengzhongyuan365-dev wants to merge 1 commit intompv-player:masterfrom
Conversation
bf0e808 to
13ff797
Compare
With prebuf=0, on underrun read_index overtakes write_index, making buf_diff negative. Passing it to pa_bytes_to_usec() (uint64_t) overflows and causes ao_drain() to hang forever via an infinite mp_cond_timedwait(). Fixes: 17651
13ff797 to
928d398
Compare
|
@Dudemanguy |
|
Do you have an easy way to reproduce this problem? |
But,the code logic also presents computational problems. If an overflow occurs, it can cause subsequent stuttering, ultimately leading to the mpv freezing. |
|
@Dudemanguy Are there any other concerns? |
|
Nothing. Someone just needs to find the time to actually verify the bug and the fix. |
ok,there is
Thread 11 (Thread 1083849.1083884 "core"): |
With prebuf=0, on underrun read_index overtakes write_index, making
buf_diff negative. Passing it to pa_bytes_to_usec() (uint64_t) overflows
and causes ao_drain() to hang forever via an infinite mp_cond_timedwait().
Fixes: 17651