From 73b37886c10f771abe05b57f53d8a570ee80b178 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sat, 13 Jul 2019 01:22:08 +1000 Subject: "AudioRenderer" thread should have a unique name Creating multiple "AudioRenderer" threads cause the previous thread to be overwritten. The thread will name be renamed to AudioRenderer-InstanceX, where X is the current instance number. --- src/audio_core/audio_renderer.cpp | 5 +++-- src/audio_core/audio_renderer.h | 2 +- src/core/hle/service/audio/audren_u.cpp | 7 +++---- src/core/hle/service/audio/audren_u.h | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/audio_core/audio_renderer.cpp b/src/audio_core/audio_renderer.cpp index 4882a6cd8..969d8f2a5 100644 --- a/src/audio_core/audio_renderer.cpp +++ b/src/audio_core/audio_renderer.cpp @@ -73,13 +73,14 @@ private: EffectInStatus info{}; }; AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, AudioRendererParameter params, - Kernel::SharedPtr buffer_event) + Kernel::SharedPtr buffer_event, + const std::size_t instance_number) : worker_params{params}, buffer_event{buffer_event}, voices(params.voice_count), effects(params.effect_count) { audio_out = std::make_unique(); stream = audio_out->OpenStream(core_timing, STREAM_SAMPLE_RATE, STREAM_NUM_CHANNELS, - "AudioRenderer", [=]() { buffer_event->Signal(); }); + fmt::format("AudioRenderer-Instance{}", instance_number), [=]() { buffer_event->Signal(); }); audio_out->StartStream(stream); QueueMixedBuffer(0); diff --git a/src/audio_core/audio_renderer.h b/src/audio_core/audio_renderer.h index b2e5d336c..1bdf709e5 100644 --- a/src/audio_core/audio_renderer.h +++ b/src/audio_core/audio_renderer.h @@ -215,7 +215,7 @@ static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has wrong size class AudioRenderer { public: AudioRenderer(Core::Timing::CoreTiming& core_timing, AudioRendererParameter params, - Kernel::SharedPtr buffer_event); + Kernel::SharedPtr buffer_event, const std::size_t instance_number); ~AudioRenderer(); std::vector UpdateAudioRenderer(const std::vector& input_params); diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 3711e1ea1..b6158d16e 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -25,7 +25,7 @@ namespace Service::Audio { class IAudioRenderer final : public ServiceFramework { public: - explicit IAudioRenderer(AudioCore::AudioRendererParameter audren_params) + explicit IAudioRenderer(AudioCore::AudioRendererParameter audren_params, const std::size_t instance_number) : ServiceFramework("IAudioRenderer") { // clang-format off static const FunctionInfo functions[] = { @@ -48,8 +48,7 @@ public: auto& system = Core::System::GetInstance(); system_event = Kernel::WritableEvent::CreateEventPair( system.Kernel(), Kernel::ResetType::Manual, "IAudioRenderer:SystemEvent"); - renderer = std::make_unique(system.CoreTiming(), audren_params, - system_event.writable); + renderer = std::make_unique(system.CoreTiming(), audren_params, system_event.writable, instance_number); } private: @@ -607,7 +606,7 @@ void AudRenU::OpenAudioRendererImpl(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(params); + rb.PushIpcInterface(params, audren_instance_count++); } bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const { diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index 1d3c8df61..49f2733cf 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h @@ -33,6 +33,7 @@ private: }; bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const; + std::size_t audren_instance_count = 0; }; } // namespace Service::Audio -- cgit v1.2.3