From 857e5fce2c1bca43b125cd2d6aecaa0f21beaae0 Mon Sep 17 00:00:00 2001 From: Rose/Wren <53360789+wren-cal@users.noreply.github.com> Date: Wed, 31 Dec 2025 19:11:26 -0800 Subject: [PATCH 1/5] Fix glm hash after repacking --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 504527e1..0adf6d01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,7 +239,7 @@ FetchContent_Declare(simdjson EXCLUDE_FROM_ALL SYSTEM URL https://github.co FetchContent_Declare(fastgltf EXCLUDE_FROM_ALL SYSTEM URL https://github.com/spnda/fastgltf/archive/refs/tags/v0.9.0.tar.gz URL_HASH SHA256=0bb564e127b14c22f062db50f89381dd2e0a20dbaf4987ca138a4ae8728712f9) FetchContent_Declare(glm EXCLUDE_FROM_ALL SYSTEM URL https://github.com/g-truc/glm/releases/download/1.0.2/glm-1.0.2.zip - URL_HASH SHA256=a41adf423315e35489c1e67689c7bb74c7edd4d207a477b7b19c45cd440c2f67) + URL_HASH SHA256=203b64abc82e4d8697cc5aeedc93117fc1ee52d36e7cdcfc0854fa2c607edaae) FetchContent_Declare(openxr_loader EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/OpenXR-SDK/archive/refs/tags/release-1.1.54.tar.gz URL_HASH SHA256=2055688081066e37238be996534f349420ac52ed34f8514836704232121ee7f3) FetchContent_Declare(spdlog EXCLUDE_FROM_ALL SYSTEM URL https://github.com/gabime/spdlog/archive/refs/tags/v1.16.0.tar.gz From eb99b474aeab4f1b500d2262243a27f0cc1d2977 Mon Sep 17 00:00:00 2001 From: Francesco <66080458+chicco-carone@users.noreply.github.com> Date: Thu, 1 Jan 2026 18:46:25 +0100 Subject: [PATCH 2/5] Fix pipewire sink setup (#716) --- server/audio/audio_pipewire.cpp | 68 ++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/server/audio/audio_pipewire.cpp b/server/audio/audio_pipewire.cpp index 34b6060a..e9749ead 100644 --- a/server/audio/audio_pipewire.cpp +++ b/server/audio/audio_pipewire.cpp @@ -104,6 +104,14 @@ struct pipewire_device : public audio_device .sample_rate = info.speaker->sample_rate, }; + // Calculate quantum size: 5ms buffer for low latency while maintaining stability + // Smaller buffers (<5ms) risk underruns, larger ones (>10ms) add perceptible latency + uint32_t quantum_size = (desc.speaker->sample_rate * 5) / 1000; + uint32_t frame_size = desc.speaker->num_channels * sizeof(int16_t); + + std::string rate_str = std::format("1/{}", desc.speaker->sample_rate); + std::string latency_str = std::format("{}/{}", quantum_size, desc.speaker->sample_rate); + speaker.reset(pw_stream_new_simple( pw_main_loop_get_loop(pw_loop.get()), sink_name.c_str(), @@ -120,6 +128,17 @@ struct pipewire_device : public audio_device "Audio/Sink", PW_KEY_MEDIA_ROLE, "Game", + // Set stream rate to match client, preventing PipeWire from doing + // unnecessary resampling which degrades audio quality + PW_KEY_NODE_RATE, + rate_str, + // Declare target latency to help PipeWire optimize buffering + PW_KEY_NODE_LATENCY, + latency_str, + // Force constant quantum size to prevent dynamic buffer size changes + // Variable buffer sizes cause crackling in effect processors (EasyEffects) + PW_KEY_NODE_FORCE_QUANTUM, + latency_str, NULL), &speaker_events, this)); @@ -127,22 +146,26 @@ struct pipewire_device : public audio_device std::vector buffer(1024); spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer.data(), uint32_t(buffer.size())); - spa_audio_info_raw info{ + spa_audio_info_raw audio_info{ .format = SPA_AUDIO_FORMAT_S16, .rate = desc.speaker->sample_rate, .channels = desc.speaker->num_channels, }; - const spa_pod * param = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &info); + const spa_pod * params[1]; + params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &audio_info); + + // Stream flags: + // - DRIVER: makes this node the graph clock master, preventing sync drift in the audio chain if (pw_stream_connect( speaker.get(), PW_DIRECTION_INPUT, PW_ID_ANY, - pw_stream_flags(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS), - ¶m, + pw_stream_flags(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_DRIVER), + params, 1) < 0) throw std::runtime_error("failed to connect speaker stream"); - U_LOG_I("pipewire speaker stream created"); + U_LOG_I("pipewire speaker stream created (quantum: %u frames, %.2f ms)", quantum_size, (quantum_size * 1000.0) / desc.speaker->sample_rate); } if (info.microphone) @@ -152,6 +175,14 @@ struct pipewire_device : public audio_device .sample_rate = info.microphone->sample_rate, }; + // Calculate quantum size: 5ms buffer for low latency while maintaining stability + // Smaller buffers (<5ms) risk underruns, larger ones (>10ms) add perceptible latency + uint32_t quantum_size = (desc.microphone->sample_rate * 5) / 1000; + uint32_t frame_size = desc.microphone->num_channels * sizeof(int16_t); + + std::string rate_str = std::format("1/{}", desc.microphone->sample_rate); + std::string latency_str = std::format("{}/{}", quantum_size, desc.microphone->sample_rate); + microphone.reset(pw_stream_new_simple( pw_main_loop_get_loop(pw_loop.get()), source_name.c_str(), @@ -168,28 +199,40 @@ struct pipewire_device : public audio_device "Audio/Source", PW_KEY_MEDIA_ROLE, "Game", + // Set stream rate to match client, preventing PipeWire from doing + // unnecessary resampling which degrades audio quality + PW_KEY_NODE_RATE, + rate_str, + // Declare target latency to help PipeWire optimize buffering + PW_KEY_NODE_LATENCY, + latency_str, + // Force constant quantum size to prevent dynamic buffer size changes + PW_KEY_NODE_FORCE_QUANTUM, + latency_str, NULL), &mic_events, this)); std::vector buffer(1024); spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer.data(), uint32_t(buffer.size())); - spa_audio_info_raw info{ + spa_audio_info_raw audio_info{ .format = SPA_AUDIO_FORMAT_S16, .rate = desc.microphone->sample_rate, .channels = desc.microphone->num_channels, }; - const spa_pod * param = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &info); + + const spa_pod * params[1]; + params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &audio_info); if (pw_stream_connect( microphone.get(), PW_DIRECTION_OUTPUT, PW_ID_ANY, pw_stream_flags(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS), - ¶m, + params, 1) < 0) throw std::runtime_error("failed to connect microphone stream"); - U_LOG_I("pipewire microphone stream created"); + U_LOG_I("pipewire microphone stream created (quantum: %u frames, %.2f ms)", quantum_size, (quantum_size * 1000.0) / desc.microphone->sample_rate); } if (desc.speaker or desc.microphone) @@ -217,10 +260,14 @@ void pipewire_device::mic_process(void * self_v) const auto & data = buffer->buffer->datas[0]; uint8_t * data_ptr = (uint8_t *)data.data; if (not data.data) + { + pw_stream_queue_buffer(self->microphone.get(), buffer); return; + } const size_t frame_size = self->desc.microphone->num_channels * sizeof(int16_t); + // Use consistent buffer size based on stream quantum #if PW_CHECK_VERSION(0, 3, 49) size_t num_frames = buffer->requested; #else @@ -228,7 +275,8 @@ void pipewire_device::mic_process(void * self_v) #endif if (num_frames == 0) { - num_frames = data.maxsize / frame_size; + uint32_t quantum_size = (self->desc.microphone->sample_rate * 5) / 1000; + num_frames = std::min(quantum_size, data.maxsize / frame_size); } data.chunk->offset = 0; data.chunk->size = 0; From fe8c320d67ace733421f03aae028ecd0187b92ea Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 1 Jan 2026 22:09:43 +0100 Subject: [PATCH 3/5] Revert "Fix pipewire sink setup (#716)" This reverts commit eb99b474aeab4f1b500d2262243a27f0cc1d2977. --- server/audio/audio_pipewire.cpp | 68 +++++---------------------------- 1 file changed, 10 insertions(+), 58 deletions(-) diff --git a/server/audio/audio_pipewire.cpp b/server/audio/audio_pipewire.cpp index e9749ead..34b6060a 100644 --- a/server/audio/audio_pipewire.cpp +++ b/server/audio/audio_pipewire.cpp @@ -104,14 +104,6 @@ struct pipewire_device : public audio_device .sample_rate = info.speaker->sample_rate, }; - // Calculate quantum size: 5ms buffer for low latency while maintaining stability - // Smaller buffers (<5ms) risk underruns, larger ones (>10ms) add perceptible latency - uint32_t quantum_size = (desc.speaker->sample_rate * 5) / 1000; - uint32_t frame_size = desc.speaker->num_channels * sizeof(int16_t); - - std::string rate_str = std::format("1/{}", desc.speaker->sample_rate); - std::string latency_str = std::format("{}/{}", quantum_size, desc.speaker->sample_rate); - speaker.reset(pw_stream_new_simple( pw_main_loop_get_loop(pw_loop.get()), sink_name.c_str(), @@ -128,17 +120,6 @@ struct pipewire_device : public audio_device "Audio/Sink", PW_KEY_MEDIA_ROLE, "Game", - // Set stream rate to match client, preventing PipeWire from doing - // unnecessary resampling which degrades audio quality - PW_KEY_NODE_RATE, - rate_str, - // Declare target latency to help PipeWire optimize buffering - PW_KEY_NODE_LATENCY, - latency_str, - // Force constant quantum size to prevent dynamic buffer size changes - // Variable buffer sizes cause crackling in effect processors (EasyEffects) - PW_KEY_NODE_FORCE_QUANTUM, - latency_str, NULL), &speaker_events, this)); @@ -146,26 +127,22 @@ struct pipewire_device : public audio_device std::vector buffer(1024); spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer.data(), uint32_t(buffer.size())); - spa_audio_info_raw audio_info{ + spa_audio_info_raw info{ .format = SPA_AUDIO_FORMAT_S16, .rate = desc.speaker->sample_rate, .channels = desc.speaker->num_channels, }; + const spa_pod * param = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &info); - const spa_pod * params[1]; - params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &audio_info); - - // Stream flags: - // - DRIVER: makes this node the graph clock master, preventing sync drift in the audio chain if (pw_stream_connect( speaker.get(), PW_DIRECTION_INPUT, PW_ID_ANY, - pw_stream_flags(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_DRIVER), - params, + pw_stream_flags(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS), + ¶m, 1) < 0) throw std::runtime_error("failed to connect speaker stream"); - U_LOG_I("pipewire speaker stream created (quantum: %u frames, %.2f ms)", quantum_size, (quantum_size * 1000.0) / desc.speaker->sample_rate); + U_LOG_I("pipewire speaker stream created"); } if (info.microphone) @@ -175,14 +152,6 @@ struct pipewire_device : public audio_device .sample_rate = info.microphone->sample_rate, }; - // Calculate quantum size: 5ms buffer for low latency while maintaining stability - // Smaller buffers (<5ms) risk underruns, larger ones (>10ms) add perceptible latency - uint32_t quantum_size = (desc.microphone->sample_rate * 5) / 1000; - uint32_t frame_size = desc.microphone->num_channels * sizeof(int16_t); - - std::string rate_str = std::format("1/{}", desc.microphone->sample_rate); - std::string latency_str = std::format("{}/{}", quantum_size, desc.microphone->sample_rate); - microphone.reset(pw_stream_new_simple( pw_main_loop_get_loop(pw_loop.get()), source_name.c_str(), @@ -199,40 +168,28 @@ struct pipewire_device : public audio_device "Audio/Source", PW_KEY_MEDIA_ROLE, "Game", - // Set stream rate to match client, preventing PipeWire from doing - // unnecessary resampling which degrades audio quality - PW_KEY_NODE_RATE, - rate_str, - // Declare target latency to help PipeWire optimize buffering - PW_KEY_NODE_LATENCY, - latency_str, - // Force constant quantum size to prevent dynamic buffer size changes - PW_KEY_NODE_FORCE_QUANTUM, - latency_str, NULL), &mic_events, this)); std::vector buffer(1024); spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer.data(), uint32_t(buffer.size())); - spa_audio_info_raw audio_info{ + spa_audio_info_raw info{ .format = SPA_AUDIO_FORMAT_S16, .rate = desc.microphone->sample_rate, .channels = desc.microphone->num_channels, }; - - const spa_pod * params[1]; - params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &audio_info); + const spa_pod * param = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &info); if (pw_stream_connect( microphone.get(), PW_DIRECTION_OUTPUT, PW_ID_ANY, pw_stream_flags(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS), - params, + ¶m, 1) < 0) throw std::runtime_error("failed to connect microphone stream"); - U_LOG_I("pipewire microphone stream created (quantum: %u frames, %.2f ms)", quantum_size, (quantum_size * 1000.0) / desc.microphone->sample_rate); + U_LOG_I("pipewire microphone stream created"); } if (desc.speaker or desc.microphone) @@ -260,14 +217,10 @@ void pipewire_device::mic_process(void * self_v) const auto & data = buffer->buffer->datas[0]; uint8_t * data_ptr = (uint8_t *)data.data; if (not data.data) - { - pw_stream_queue_buffer(self->microphone.get(), buffer); return; - } const size_t frame_size = self->desc.microphone->num_channels * sizeof(int16_t); - // Use consistent buffer size based on stream quantum #if PW_CHECK_VERSION(0, 3, 49) size_t num_frames = buffer->requested; #else @@ -275,8 +228,7 @@ void pipewire_device::mic_process(void * self_v) #endif if (num_frames == 0) { - uint32_t quantum_size = (self->desc.microphone->sample_rate * 5) / 1000; - num_frames = std::min(quantum_size, data.maxsize / frame_size); + num_frames = data.maxsize / frame_size; } data.chunk->offset = 0; data.chunk->size = 0; From 6be85971ea11f9f7e1bbf9dd7961fe3b2f73cdb6 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 1 Jan 2026 19:51:30 +0100 Subject: [PATCH 4/5] Fix invisible buttons when going back --- dashboard/qml/Main.qml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dashboard/qml/Main.qml b/dashboard/qml/Main.qml index 2abf702b..29ad00a2 100644 --- a/dashboard/qml/Main.qml +++ b/dashboard/qml/Main.qml @@ -370,14 +370,12 @@ Kirigami.ApplicationWindow { text: i18n("Wizard") icon.name: "tools-wizard-symbolic" onTriggered: root.pageStack.push(Qt.createComponent("WizardPage.qml").createObject()) - visible: root.pageStack.depth == 1 enabled: root.server_started }, Kirigami.Action { text: i18n("Install the app") icon.name: "install-symbolic" onTriggered: root.pageStack.push(Qt.createComponent("ApkInstallPage.qml").createObject()) - visible: root.pageStack.depth == 1 enabled: root.server_started && Adb.adbInstalled tooltip: { if (!root.server_started) @@ -391,21 +389,18 @@ Kirigami.ApplicationWindow { text: i18n("Headsets") icon.name: "item-symbolic" onTriggered: root.pageStack.push(Qt.createComponent("HeadsetsPage.qml").createObject()) - visible: root.pageStack.depth == 1 enabled: root.server_started }, Kirigami.Action { text: i18n("Settings") icon.name: "settings-configure-symbolic" onTriggered: root.pageStack.push(Qt.createComponent("SettingsPage.qml").createObject()) - visible: root.pageStack.depth == 1 enabled: root.server_started }, Kirigami.Action { text: i18n("Troubleshoot") icon.name: "help-contents-symbolic" onTriggered: root.pageStack.push(Qt.createComponent("TroubleshootPage.qml").createObject()) - enabled: root.pageStack.depth == 1 } ] } From 1e488a8a9c4be6fefae1fc63d9f23f65ebf53a06 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 1 Jan 2026 20:22:34 +0100 Subject: [PATCH 5/5] Prevent going back after first page --- dashboard/qml/ApkInstallPage.qml | 2 +- dashboard/qml/HeadsetStatsPage.qml | 2 +- dashboard/qml/HeadsetsPage.qml | 2 +- dashboard/qml/SettingsPage.qml | 2 +- dashboard/qml/TroubleshootPage.qml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dashboard/qml/ApkInstallPage.qml b/dashboard/qml/ApkInstallPage.qml index 94069c85..be29c530 100644 --- a/dashboard/qml/ApkInstallPage.qml +++ b/dashboard/qml/ApkInstallPage.qml @@ -70,6 +70,6 @@ Kirigami.ScrollablePage { Shortcut { sequences: [StandardKey.Cancel] - onActivated: applicationWindow().pageStack.pop() + onActivated: {if (isCurrentPage) applicationWindow().pageStack.pop();} } } diff --git a/dashboard/qml/HeadsetStatsPage.qml b/dashboard/qml/HeadsetStatsPage.qml index 3bd5d9e8..f0eb55bc 100644 --- a/dashboard/qml/HeadsetStatsPage.qml +++ b/dashboard/qml/HeadsetStatsPage.qml @@ -41,6 +41,6 @@ Kirigami.ScrollablePage { Shortcut { sequences: [StandardKey.Cancel] - onActivated: applicationWindow().pageStack.pop() + onActivated: {if (isCurrentPage) applicationWindow().pageStack.pop();} } } diff --git a/dashboard/qml/HeadsetsPage.qml b/dashboard/qml/HeadsetsPage.qml index 6a71e708..7b54d74a 100644 --- a/dashboard/qml/HeadsetsPage.qml +++ b/dashboard/qml/HeadsetsPage.qml @@ -197,6 +197,6 @@ Kirigami.ScrollablePage { Shortcut { sequences: [StandardKey.Cancel] - onActivated: applicationWindow().pageStack.pop() + onActivated: {if (isCurrentPage) applicationWindow().pageStack.pop();} } } diff --git a/dashboard/qml/SettingsPage.qml b/dashboard/qml/SettingsPage.qml index 6b994881..35755c2e 100644 --- a/dashboard/qml/SettingsPage.qml +++ b/dashboard/qml/SettingsPage.qml @@ -284,6 +284,6 @@ Kirigami.ScrollablePage { Shortcut { sequences: [StandardKey.Cancel] - onActivated: applicationWindow().pageStack.pop() + onActivated: {if (isCurrentPage) applicationWindow().pageStack.pop();} } } diff --git a/dashboard/qml/TroubleshootPage.qml b/dashboard/qml/TroubleshootPage.qml index 4529b37c..00357f90 100644 --- a/dashboard/qml/TroubleshootPage.qml +++ b/dashboard/qml/TroubleshootPage.qml @@ -94,6 +94,6 @@ Kirigami.ScrollablePage { Shortcut { sequences: [StandardKey.Cancel] - onActivated: applicationWindow().pageStack.pop() + onActivated: {if (isCurrentPage) applicationWindow().pageStack.pop();} } }