aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-04-23 19:11:58 +0200
committerdec05eba <dec05eba@protonmail.com>2025-04-23 19:11:58 +0200
commit15176579cb71224c529c1a35ac771cd13192737a (patch)
tree8ff16f5c9a4af3dd6504984c17cc576dc2a04de2 /src/main.cpp
parent8bd17b0c9a8529c0e0b1bcad57130759ebcaa004 (diff)
Fix replay saving freeze, unable to save replay if audio is not provided
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 84541df..73af76d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1270,13 +1270,13 @@ static void save_replay_async(AVCodecContext *video_codec_context, int video_str
}
const size_t audio_start_index = gsr_replay_buffer_find_keyframe(replay_buffer, video_start_index, video_stream_index, true);
- if(audio_start_index == (size_t)-1) {
- fprintf(stderr, "gsr error: failed to save replay: failed to find an audio keyframe. perhaps replay was saved too fast, before anything has been recorded\n");
- return;
- }
+ // if(audio_start_index == (size_t)-1) {
+ // fprintf(stderr, "gsr error: failed to save replay: failed to find an audio keyframe. perhaps replay was saved too fast, before anything has been recorded\n");
+ // return;
+ // }
const int64_t video_pts_offset = gsr_replay_buffer_get_packet_at_index(replay_buffer, video_start_index)->packet.pts;
- const int64_t audio_pts_offset = gsr_replay_buffer_get_packet_at_index(replay_buffer, audio_start_index)->packet.pts;
+ const int64_t audio_pts_offset = audio_start_index == (size_t)-1 ? 0 : gsr_replay_buffer_get_packet_at_index(replay_buffer, audio_start_index)->packet.pts;
gsr_replay_buffer cloned_replay_buffer;
if(!gsr_replay_buffer_clone(replay_buffer, &cloned_replay_buffer)) {