summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_coreaudio_utils.c
diff options
context:
space:
mode:
authorleetoburrito <11300961+leetoburrito@users.noreply.github.com>2023-11-23 00:16:49 -0800
committersfan5 <sfan5@live.de>2023-11-23 11:22:21 +0100
commite22a2f04833852ce825eb7c1235d9bdaaa9b2397 (patch)
tree494e04e010c5c1f6a3b1209e75d1857279da811c /audio/out/ao_coreaudio_utils.c
parente575ec4fc3654387c7358bd3640877ef32628d2c (diff)
downloadmpv-e22a2f04833852ce825eb7c1235d9bdaaa9b2397.tar.bz2
mpv-e22a2f04833852ce825eb7c1235d9bdaaa9b2397.tar.xz
ao/coreaudio_exclusive: fix segfault when changing formats
PR #12747 missed updating a variable declaration in `ca_change_physical_format_sync`, which ultimately leads to the thread crashing. The problem reproduces consistently on AS Macs (I don't have an Intel Mac to test on anymore), and produces stack traces like the following: ``` Thread 3 Crashed:: mpv 0 libsystem_kernel.dylib 0x18cebd11c __pthread_kill + 8 1 libsystem_pthread.dylib 0x18cef4cc0 pthread_kill + 288 2 libsystem_c.dylib 0x18ce04ad4 __abort + 136 3 libsystem_c.dylib 0x18cdf56c4 __stack_chk_fail + 96 4 mpv 0x1026b66d0 ca_change_physical_format_sync + 420 5 mpv 0x1026b3b70 init + 1052 6 mpv 0x1025c5afc ao_init + 332 7 mpv 0x1025c5bec ao_init + 572 8 mpv 0x1025c5830 ao_init_best + 1228 9 mpv 0x102622fac fill_audio_out_buffers + 1820 10 mpv 0x1026450d0 run_playloop + 132 11 mpv 0x10263f958 play_current_file + 5116 12 mpv 0x10263e4e8 mp_play_files + 452 13 mpv 0x102641308 mpv_main + 128 14 mpv 0x10269f520 playback_thread + 40 15 libsystem_pthread.dylib 0x18cef5034 _pthread_start + 136 16 libsystem_pthread.dylib 0x18ceefe3c thread_start + 8 ``` Note that non-exclusive output seems to be unaffected. To reproduce this problem (and/or test this fix), pass `--audio-exclusive=yes` to mpv.
Diffstat (limited to 'audio/out/ao_coreaudio_utils.c')
-rw-r--r--audio/out/ao_coreaudio_utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/audio/out/ao_coreaudio_utils.c b/audio/out/ao_coreaudio_utils.c
index 14db8e39cd..978165d652 100644
--- a/audio/out/ao_coreaudio_utils.c
+++ b/audio/out/ao_coreaudio_utils.c
@@ -470,7 +470,7 @@ bool ca_change_physical_format_sync(struct ao *ao, AudioStreamID stream,
ca_print_asbd(ao, "setting stream physical format:", &change_format);
- sem_t wakeup;
+ mp_sem_t wakeup;
if (mp_sem_init(&wakeup, 0, 0)) {
MP_WARN(ao, "OOM\n");
return false;