aboutsummaryrefslogtreecommitdiff
path: root/src/audio_core
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-31 08:53:11 -0400
committerTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-31 08:53:11 -0400
commitdf8d77511bcc1d8b6a7ef5afa6ac27a0dcdfe870 (patch)
treec1ffefdadc26adfb43adf811b88aead126e102e6 /src/audio_core
parent2b72e348561bd4696d3e44ca3b855fe565106c64 (diff)
audio: don't free an upsampler when cleaning up a circular buffer sink
CircularBufferSinkInfo::CleanUp read its state as a DeviceState and freed DeviceState::upsampler_info. Only device sinks own an upsampler; a circular buffer sink's state starts with its buffer positions, so a game that changed or removed its circular buffer sink made the audio service free a pointer built from those positions and crash the emulator. Mario Tennis Fever does this during startup.
Diffstat (limited to 'src/audio_core')
-rw-r--r--src/audio_core/renderer/sink/circular_buffer_sink_info.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp b/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp
index 0ede02b6b4..7e25413fe1 100644
--- a/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp
+++ b/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp
@@ -3,7 +3,6 @@
#include "audio_core/renderer/memory/pool_mapper.h"
#include "audio_core/renderer/sink/circular_buffer_sink_info.h"
-#include "audio_core/renderer/upsampler/upsampler_manager.h"
namespace AudioCore::Renderer {
@@ -17,13 +16,9 @@ CircularBufferSinkInfo::CircularBufferSinkInfo() {
}
void CircularBufferSinkInfo::CleanUp() {
- auto state_{reinterpret_cast<DeviceState*>(state.data())};
-
- if (state_->upsampler_info) {
- state_->upsampler_info->manager->Free(state_->upsampler_info);
- state_->upsampler_info = nullptr;
- }
-
+ // Only device sinks own an upsampler. This sink's state is a CircularBufferState, whose
+ // first words are buffer positions: reading them as DeviceState::upsampler_info freed a
+ // garbage pointer when a game changed or removed its circular buffer sink.
parameter.fill(0);
type = Type::Invalid;
}