audio_core: Dispose of current audio sink before opening new one. (#6567)
This commit is contained in:
parent
72b82ef6ed
commit
848116b5be
1 changed files with 3 additions and 0 deletions
|
@ -17,6 +17,9 @@ DspInterface::DspInterface() = default;
|
||||||
DspInterface::~DspInterface() = default;
|
DspInterface::~DspInterface() = default;
|
||||||
|
|
||||||
void DspInterface::SetSink(AudioCore::SinkType sink_type, std::string_view audio_device) {
|
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 = CreateSinkFromID(sink_type, audio_device);
|
||||||
sink->SetCallback(
|
sink->SetCallback(
|
||||||
[this](s16* buffer, std::size_t num_frames) { OutputCallback(buffer, num_frames); });
|
[this](s16* buffer, std::size_t num_frames) { OutputCallback(buffer, num_frames); });
|
||||||
|
|
Loading…
Reference in a new issue