summaryrefslogtreecommitdiffstats
path: root/audio/filter/af_scaletempo2.c
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-04-25 13:08:41 -0400
committerKacper Michajłow <kasper93@gmail.com>2024-04-27 00:59:09 +0200
commit51e01e9772c157da02afe5a018c66f06231d732f (patch)
treeb74602f4171ce6a0bba049d345ac3c4175369d1c /audio/filter/af_scaletempo2.c
parent7f0961479afb2b010cdccfc306c63134c1d0c7c6 (diff)
downloadmpv-51e01e9772c157da02afe5a018c66f06231d732f.tar.bz2
mpv-51e01e9772c157da02afe5a018c66f06231d732f.tar.xz
ao_wasapi: fix player core lockup when avoiding premature buffer fills
6863eefc3d1d683a08f56aeaca0b4706672f2447 handled this situation by using an atomic variable to express the state for which the wakeup is caused by AO control, and the dispatch queue is only processed at this state. However, this can cause permanent lockup of the player core when the following happens: - AO control sets the thread state to WASAPI_THREAD_DISPATCH, and sets the wakeup handle. - WASAPI thread reads the WASAPI_THREAD_DISPATCH state and processes the dispatch queue. - Another AO control happens. A dispatch item is enqueued, and the state stays at WASAPI_THREAD_DISPATCH. - WASAPI thread resets the thread state to WASAPI_THREAD_FEED since the state has not changed. - WaitForSingleObject() returns in the WASAPI thread, sees this state, and does not process the dispatch queue. - The player core locks permanently because it is waiting for the dispatch to be processed. This has been experimentally verified on a system under high contention: The easiest way to trigger this lockup is to continuously hold down "i", which rapidly issues AO get volume/mute controls. To properly handle this, use separate handles for system and user wakeup requests. Only feed audio when woke up by system and only process the dispatch queue when woke up by user. Fixes: 6863eefc3d1d683a08f56aeaca0b4706672f2447
Diffstat (limited to 'audio/filter/af_scaletempo2.c')
0 files changed, 0 insertions, 0 deletions