diff --git a/client/configuration.cpp b/client/configuration.cpp index 6d7b08a0..9d146200 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -194,10 +194,10 @@ configuration::configuration(xr::system & system) preferred_refresh_rate.reset(); minimum_refresh_rate.reset(); resolution_scale = 1.0; - stream_scale = 0.5; bitrate_bps = 50'000'000; openxr_post_processing = {}; passthrough_enabled = system.passthrough_supported() == xr::passthrough_type::color; + stream_scale.reset(); } } @@ -258,7 +258,8 @@ void configuration::save() if (minimum_refresh_rate) json << ",\"minimum_refresh_rate\":" << *minimum_refresh_rate; json << ",\"resolution_scale\":" << resolution_scale; - json << ",\"stream_scale\":" << stream_scale; + if (stream_scale) + json << ",\"stream_scale\":" << *stream_scale; json << ",\"bitrate_bps\":" << bitrate_bps; json << ",\"openxr_post_processing\":"; write_openxr_post_processing(json, openxr_post_processing); @@ -279,3 +280,17 @@ void configuration::save() json << ",\"high_power_mode\":" << std::boolalpha << high_power_mode; json << "}"; } + +void configuration::set_stream_scale(float val) +{ + stream_scale = val; +} + +float configuration::get_stream_scale() const +{ + if (stream_scale) + return *stream_scale; + if (check_feature(feature::eye_gaze)) + return 0.3; + return 0.5; +} diff --git a/client/configuration.h b/client/configuration.h index 6d54d8a6..42ac86d2 100644 --- a/client/configuration.h +++ b/client/configuration.h @@ -50,7 +50,6 @@ public: std::optional preferred_refresh_rate; std::optional minimum_refresh_rate; float resolution_scale = 1.0; - float stream_scale = 0.5; uint32_t bitrate_bps = 50'000'000; bool passthrough_enabled = false; bool mic_unprocessed_audio = false; @@ -88,6 +87,7 @@ public: private: mutable std::mutex mutex; std::map features; + std::optional stream_scale; void parse_openxr_post_processing_options(simdjson::simdjson_result root); @@ -96,4 +96,7 @@ public: configuration() = default; void save(); + + void set_stream_scale(float); + float get_stream_scale() const; }; diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index f71a5e54..c83b2a57 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -673,7 +673,7 @@ void scenes::lobby::gui_settings() // Stream resolution { const int step = 10; - const auto current = config.stream_scale; + const auto current = config.get_stream_scale(); auto intval = int(current * 100 / step); const auto slider = ImGui::SliderInt( _("Stream resolution").append("##stream_scale").c_str(), @@ -685,7 +685,7 @@ void scenes::lobby::gui_settings() { // clamp out of the slider to have the 50% value centered intval = std::clamp(intval, 20 / step, 100 / step); - config.stream_scale = intval * step * 0.01; + config.set_stream_scale(intval * step * 0.01); config.save(); } imgui_ctx->vibrate_on_hover(); diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 230e2fd8..e41b14de 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -222,8 +222,11 @@ std::shared_ptr scenes::stream::create(std::unique_ptrinstance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME)) {