aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-04-03 10:39:57 +0200
committerdec05eba <dec05eba@protonmail.com>2023-04-03 10:45:00 +0200
commit10d7bf93e864fc6b3c83ad7a913ea05d39256c03 (patch)
treec391d20f3521df11391580dd6795ec301aee7ccc
parente301925d9836bd9adb98c2b53075fcfc69969f81 (diff)
Cleanup replay packets after use
-rw-r--r--src/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a92b251..6b794ad 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2048,6 +2048,10 @@ int main(int argc, char **argv) {
if(save_replay_thread.valid() && save_replay_thread.wait_for(std::chrono::seconds(0)) == std::future_status::ready) {
save_replay_thread.get();
puts(save_replay_output_filepath.c_str());
+ std::lock_guard<std::mutex> lock(write_output_mutex);
+ for(AVPacket &packet : save_replay_packets) {
+ av_packet_unref(&packet);
+ }
save_replay_packets.clear();
}
@@ -2068,6 +2072,11 @@ int main(int argc, char **argv) {
if(save_replay_thread.valid()) {
save_replay_thread.get();
puts(save_replay_output_filepath.c_str());
+ std::lock_guard<std::mutex> lock(write_output_mutex);
+ for(AVPacket &packet : save_replay_packets) {
+ av_packet_unref(&packet);
+ }
+ save_replay_packets.clear();
}
for(AudioTrack &audio_track : audio_tracks) {