0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00
mpv/audio
nanahi 51e01e9772 ao_wasapi: fix player core lockup when avoiding premature buffer fills
6863eefc3d 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: 6863eefc3d
2024-04-27 00:59:09 +02:00
..
decode player/command: add video-codec-info and audio-codec-info 2024-04-15 19:34:40 +02:00
filter af_scaletempo2: prioritize louder channels for similarity measure 2024-04-12 17:40:00 +00:00
out ao_wasapi: fix player core lockup when avoiding premature buffer fills 2024-04-27 00:59:09 +02:00
aframe.c various: replace if + abort() with MP_HANDLE_OOM() 2023-01-12 22:02:07 +01:00
aframe.h ad_lavc: strip non-normalized floats 2022-09-02 01:27:31 +02:00
chmap_avchannel.c audio: add AVChannelLayout helpers to convert from/to mp_chmap 2022-06-12 21:05:59 +03:00
chmap_avchannel.h audio: add AVChannelLayout helpers to convert from/to mp_chmap 2022-06-12 21:05:59 +03:00
chmap_sel.c audio: use --audio-channels=auto behavior, except on ALSA 2016-08-04 20:49:20 +02:00
chmap_sel.h audio: use --audio-channels=auto behavior, except on ALSA 2016-08-04 20:49:20 +02:00
chmap.c chmap: mp_image_pool: drop stale mentions of Libav in comments 2024-01-20 16:10:20 +00:00
chmap.h audio/chmap: support up to 64 channels 2023-09-29 02:35:10 +00:00
fmt-conversion.c audio: add support for AV_SAMPLE_FMT_S64* 2019-09-27 21:21:34 +02:00
fmt-conversion.h audio/fmt-conversion: change license to LGPL 2017-05-05 07:25:55 +02:00
format.c audio/format: fix Type 'struct entry' has incompatible definitions in different translation units 2022-10-23 14:57:24 +02:00
format.h audio: add support for AV_SAMPLE_FMT_S64* 2019-09-27 21:21:34 +02:00