Dont show replay save 1/10 min if replay buffer is set to a lower time

This commit is contained in:
dec05eba
2025-11-03 23:11:12 +01:00
parent 9af3c85161
commit 2bc2252d30
3 changed files with 20 additions and 6 deletions

2
TODO
View File

@@ -244,3 +244,5 @@ Add recording timer when recording to show for how long we have been recording f
Add option to trim video in the ui. Show a list of all videos recorded so you dont have to navigate to them (maybe add option to manually navigate to a video as well). Maybe use mpv to view it (embedded) in the ui and trim regions (multiple) and ffmpeg command to trim it. Add option to trim video in the ui. Show a list of all videos recorded so you dont have to navigate to them (maybe add option to manually navigate to a video as well). Maybe use mpv to view it (embedded) in the ui and trim regions (multiple) and ffmpeg command to trim it.
Show the currently recorded capture in the ui, to preview if everything looks ok. This is also good for webcam overlay. Do this when gsr supports rpc, which would also include an option to get a fd to the capture texture. Show the currently recorded capture in the ui, to preview if everything looks ok. This is also good for webcam overlay. Do this when gsr supports rpc, which would also include an option to get a fd to the capture texture.
Show a question mark beside options. When hovering the question mark show a tooltip that explains the options.

View File

@@ -165,6 +165,7 @@ namespace gsr {
GsrInfo gsr_info; GsrInfo gsr_info;
egl_functions egl_funcs; egl_functions egl_funcs;
Config config; Config config;
Config current_recording_config;
bool visible = false; bool visible = false;
@@ -240,7 +241,6 @@ namespace gsr {
bool try_replay_startup = true; bool try_replay_startup = true;
bool replay_recording = false; bool replay_recording = false;
int replay_save_duration_min = 0; int replay_save_duration_min = 0;
double replay_buffer_save_duration_sec = 0.0;
mgl::Clock replay_duration_clock; mgl::Clock replay_duration_clock;
double replay_saved_duration_sec = 0.0; double replay_saved_duration_sec = 0.0;
bool replay_restart_on_save = false; bool replay_restart_on_save = false;

View File

@@ -463,6 +463,7 @@ namespace gsr {
gsr_info(std::move(gsr_info)), gsr_info(std::move(gsr_info)),
egl_funcs(egl_funcs), egl_funcs(egl_funcs),
config(capture_options), config(capture_options),
current_recording_config(capture_options),
bg_screenshot_overlay({0.0f, 0.0f}), bg_screenshot_overlay({0.0f, 0.0f}),
top_bar_background({0.0f, 0.0f}), top_bar_background({0.0f, 0.0f}),
close_button_widget({0.0f, 0.0f}) close_button_widget({0.0f, 0.0f})
@@ -1857,8 +1858,8 @@ namespace gsr {
double Overlay::get_time_passed_in_replay_buffer_seconds() { double Overlay::get_time_passed_in_replay_buffer_seconds() {
double replay_duration_sec = replay_saved_duration_sec; double replay_duration_sec = replay_saved_duration_sec;
if(replay_duration_sec > replay_buffer_save_duration_sec) if(replay_duration_sec > current_recording_config.replay_config.replay_time)
replay_duration_sec = replay_buffer_save_duration_sec; replay_duration_sec = current_recording_config.replay_config.replay_time;
if(replay_save_duration_min > 0 && replay_duration_sec > replay_save_duration_min * 60) if(replay_save_duration_min > 0 && replay_duration_sec > replay_save_duration_min * 60)
replay_duration_sec = replay_save_duration_min * 60; replay_duration_sec = replay_save_duration_min * 60;
return replay_duration_sec; return replay_duration_sec;
@@ -2309,8 +2310,8 @@ namespace gsr {
replay_dropdown_button_ptr->set_description("On"); replay_dropdown_button_ptr->set_description("On");
replay_dropdown_button_ptr->set_item_icon("start", &get_theme().stop_texture); replay_dropdown_button_ptr->set_item_icon("start", &get_theme().stop_texture);
replay_dropdown_button_ptr->set_item_enabled("save", true); replay_dropdown_button_ptr->set_item_enabled("save", true);
replay_dropdown_button_ptr->set_item_enabled("save_1_min", true); replay_dropdown_button_ptr->set_item_enabled("save_1_min", current_recording_config.replay_config.replay_time >= 60);
replay_dropdown_button_ptr->set_item_enabled("save_10_min", true); replay_dropdown_button_ptr->set_item_enabled("save_10_min", current_recording_config.replay_config.replay_time >= 60 * 10);
} }
void Overlay::update_ui_replay_stopped() { void Overlay::update_ui_replay_stopped() {
@@ -2523,6 +2524,9 @@ namespace gsr {
if(recording_status != RecordingStatus::REPLAY || gpu_screen_recorder_process <= 0) if(recording_status != RecordingStatus::REPLAY || gpu_screen_recorder_process <= 0)
return; return;
if(current_recording_config.replay_config.replay_time < 60)
return;
replay_save_duration_min = 1; replay_save_duration_min = 1;
replay_save_show_notification = true; replay_save_show_notification = true;
replay_save_clock.restart(); replay_save_clock.restart();
@@ -2534,6 +2538,9 @@ namespace gsr {
if(recording_status != RecordingStatus::REPLAY || gpu_screen_recorder_process <= 0) if(recording_status != RecordingStatus::REPLAY || gpu_screen_recorder_process <= 0)
return; return;
if(current_recording_config.replay_config.replay_time < 60 * 10)
return;
replay_save_duration_min = 10; replay_save_duration_min = 10;
replay_save_show_notification = true; replay_save_show_notification = true;
replay_save_clock.restart(); replay_save_clock.restart();
@@ -2714,6 +2721,8 @@ namespace gsr {
args.push_back(nullptr); args.push_back(nullptr);
current_recording_config = config;
gpu_screen_recorder_process = exec_program(args.data(), &gpu_screen_recorder_process_output_fd); gpu_screen_recorder_process = exec_program(args.data(), &gpu_screen_recorder_process_output_fd);
if(gpu_screen_recorder_process == -1) { if(gpu_screen_recorder_process == -1) {
show_notification("Failed to launch gpu-screen-recorder to start replay", notification_error_timeout_seconds, mgl::Color(255, 0, 0), mgl::Color(255, 0, 0), NotificationType::REPLAY, nullptr, NotificationLevel::ERROR); show_notification("Failed to launch gpu-screen-recorder to start replay", notification_error_timeout_seconds, mgl::Color(255, 0, 0), mgl::Color(255, 0, 0), NotificationType::REPLAY, nullptr, NotificationLevel::ERROR);
@@ -2746,7 +2755,6 @@ namespace gsr {
// TODO: This will be incorrect if the user uses portal capture, as capture wont start until the user has // TODO: This will be incorrect if the user uses portal capture, as capture wont start until the user has
// selected what to capture and accepted it. // selected what to capture and accepted it.
replay_duration_clock.restart(); replay_duration_clock.restart();
replay_buffer_save_duration_sec = config.replay_config.replay_time;
return true; return true;
} }
@@ -2894,6 +2902,8 @@ namespace gsr {
args.push_back(nullptr); args.push_back(nullptr);
current_recording_config = config;
record_filepath = output_file; record_filepath = output_file;
gpu_screen_recorder_process = exec_program(args.data(), &gpu_screen_recorder_process_output_fd); gpu_screen_recorder_process = exec_program(args.data(), &gpu_screen_recorder_process_output_fd);
if(gpu_screen_recorder_process == -1) { if(gpu_screen_recorder_process == -1) {
@@ -3078,6 +3088,8 @@ namespace gsr {
args.push_back(nullptr); args.push_back(nullptr);
current_recording_config = config;
gpu_screen_recorder_process = exec_program(args.data(), &gpu_screen_recorder_process_output_fd); gpu_screen_recorder_process = exec_program(args.data(), &gpu_screen_recorder_process_output_fd);
if(gpu_screen_recorder_process == -1) { if(gpu_screen_recorder_process == -1) {
show_notification("Failed to launch gpu-screen-recorder to start streaming", notification_error_timeout_seconds, mgl::Color(255, 0, 0), mgl::Color(255, 0, 0), NotificationType::STREAM, nullptr, NotificationLevel::ERROR); show_notification("Failed to launch gpu-screen-recorder to start streaming", notification_error_timeout_seconds, mgl::Color(255, 0, 0), mgl::Color(255, 0, 0), NotificationType::STREAM, nullptr, NotificationLevel::ERROR);