From 848116b5be6be6c7d24ac099a579e19fc21f2c27 Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Thu, 25 May 2023 15:44:56 -0700 Subject: [PATCH] audio_core: Dispose of current audio sink before opening new one. (#6567) --- src/audio_core/dsp_interface.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/audio_core/dsp_interface.cpp b/src/audio_core/dsp_interface.cpp index cac30e156..fee8caed9 100644 --- a/src/audio_core/dsp_interface.cpp +++ b/src/audio_core/dsp_interface.cpp @@ -17,6 +17,9 @@ DspInterface::DspInterface() = default; DspInterface::~DspInterface() = default; void DspInterface::SetSink(AudioCore::SinkType sink_type, std::string_view audio_device) { + // Dispose of the current sink first to avoid contention. + sink.reset(); + sink = CreateSinkFromID(sink_type, audio_device); sink->SetCallback( [this](s16* buffer, std::size_t num_frames) { OutputCallback(buffer, num_frames); });