From 211cc5e28f62bdca163412cce3ec627a1577580a Mon Sep 17 00:00:00 2001 From: MerryMage Date: Tue, 24 Oct 2017 02:19:36 +0100 Subject: [PATCH] sdl2_sink: Disallow audio device from changing any parameter other than the frequency We currently do not handle the cases when channel number or channel format differ from what we expect. --- src/audio_core/sdl2_sink.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio_core/sdl2_sink.cpp b/src/audio_core/sdl2_sink.cpp index 933c5f16d1..7852ca8d23 100644 --- a/src/audio_core/sdl2_sink.cpp +++ b/src/audio_core/sdl2_sink.cpp @@ -55,8 +55,8 @@ SDL2Sink::SDL2Sink() : impl(std::make_unique()) { device = Settings::values.audio_device_id.c_str(); } - impl->audio_device_id = SDL_OpenAudioDevice(device, false, &desired_audiospec, - &obtained_audiospec, SDL_AUDIO_ALLOW_ANY_CHANGE); + impl->audio_device_id = SDL_OpenAudioDevice( + device, false, &desired_audiospec, &obtained_audiospec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); if (impl->audio_device_id <= 0) { LOG_CRITICAL(Audio_Sink, "SDL_OpenAudioDevice failed with code %d for device \"%s\"", impl->audio_device_id, Settings::values.audio_device_id.c_str());