diff options
| author | dec05eba <dec05eba@protonmail.com> | 2026-08-07 13:53:40 +0200 |
|---|---|---|
| committer | dec05eba <dec05eba@protonmail.com> | 2026-08-07 13:53:40 +0200 |
| commit | 90ac49f372f4c3d3d12f4d0d58ab0473a86821d5 (patch) | |
| tree | d3faf489bc8bb5d9c67abda5a4f04d330ce42607 /include | |
| parent | e31968fc4074df739c00947b993ee19be4ef1caa (diff) | |
Revert "Clear replay data in replay save thread to not block the main capture thread"
This reverts commit 5db30f3fb99545524fc80f87ecc488972aec1711.
Diffstat (limited to 'include')
| -rw-r--r-- | include/recorder/replay_save.h | 10 | ||||
| -rw-r--r-- | include/replay_buffer/replay_buffer.h | 9 |
2 files changed, 2 insertions, 17 deletions
diff --git a/include/recorder/replay_save.h b/include/recorder/replay_save.h index ac4eb98..7f48851 100644 --- a/include/recorder/replay_save.h +++ b/include/recorder/replay_save.h @@ -37,20 +37,14 @@ typedef struct { gsr_audio_pts_offset *audio_pts_offsets; size_t num_audio_pts_offsets; gsr_replay_buffer *cloned_replay_buffer; - /* The data that the replay buffer had before it was restarted, free'd on the replay save thread */ - gsr_replay_buffer *restarted_replay_buffer_data; gsr_encoder *encoder; } gsr_replay_save; void gsr_replay_save_init(gsr_replay_save *self); bool gsr_replay_save_is_running(const gsr_replay_save *self); -/* - Returns false if the replay failed to start. |current_save_replay_seconds| can be GSR_SAVE_REPLAY_SECONDS_FULL to save the whole replay buffer. - The replay buffer of |encoder| is restarted (emptied) when |restart_replay| is set, which is done without blocking the - thread that appends to the replay buffer by free'ing the old data on the replay save thread. -*/ -bool gsr_replay_save_start(gsr_replay_save *self, AVCodecContext *video_codec_context, int video_stream_index, const gsr_audio_capture *audio_capture, gsr_encoder *encoder, const gsr_recorder_settings *settings, const char *file_extension, bool hdr, gsr_video_sources *video_sources, int current_save_replay_seconds, bool restart_replay); +/* Returns false if the replay failed to start. |current_save_replay_seconds| can be GSR_SAVE_REPLAY_SECONDS_FULL to save the whole replay buffer */ +bool gsr_replay_save_start(gsr_replay_save *self, AVCodecContext *video_codec_context, int video_stream_index, const gsr_audio_capture *audio_capture, gsr_encoder *encoder, const gsr_recorder_settings *settings, const char *file_extension, bool hdr, gsr_video_sources *video_sources, int current_save_replay_seconds); /* Returns true when the replay finished saving, in which case |success| and |output_filepath| are set. |output_filepath| is empty when nothing was saved */ bool gsr_replay_save_poll(gsr_replay_save *self, bool *success, const char **output_filepath); /* Waits for an ongoing replay save to finish. Returns the same values as gsr_replay_save_poll */ diff --git a/include/replay_buffer/replay_buffer.h b/include/replay_buffer/replay_buffer.h index 3ac452a..bf2e4e6 100644 --- a/include/replay_buffer/replay_buffer.h +++ b/include/replay_buffer/replay_buffer.h @@ -22,8 +22,6 @@ struct gsr_replay_buffer { uint8_t* (*iterator_get_packet_data)(gsr_replay_buffer *self, gsr_replay_buffer_iterator iterator); /* The clone has to be destroyed before the replay buffer it clones is destroyed */ gsr_replay_buffer* (*clone)(gsr_replay_buffer *self); - /* Returns NULL on failure, in which case |self| is left untouched */ - gsr_replay_buffer* (*take_data)(gsr_replay_buffer *self); /* Returns {0, 0} if replay buffer is empty */ gsr_replay_buffer_iterator (*find_packet_index_by_time_passed)(gsr_replay_buffer *self, int seconds); /* Returns {-1, 0} if not found */ @@ -48,13 +46,6 @@ AVPacket* gsr_replay_buffer_iterator_get_packet(gsr_replay_buffer *self, gsr_rep uint8_t* gsr_replay_buffer_iterator_get_packet_data(gsr_replay_buffer *self, gsr_replay_buffer_iterator iterator); /* The clone has to be destroyed before the replay buffer it clones is destroyed */ gsr_replay_buffer* gsr_replay_buffer_clone(gsr_replay_buffer *self); -/* - Moves the data of |self| into a new replay buffer and leaves |self| empty and ready to be used again. - This is a cheap operation, unlike gsr_replay_buffer_clear, because freeing the data is deferred to - gsr_replay_buffer_destroy of the returned replay buffer, which can be done without blocking |self|. - Returns NULL on failure, in which case |self| is left untouched. -*/ -gsr_replay_buffer* gsr_replay_buffer_take_data(gsr_replay_buffer *self); /* Returns {0, 0} if replay buffer is empty */ gsr_replay_buffer_iterator gsr_replay_buffer_find_packet_index_by_time_passed(gsr_replay_buffer *self, int seconds); /* Returns {-1, 0} if not found */ |
