From 41bd6cee631a16076435984891f2134443ecec31 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 18 Sep 2024 00:11:23 +0200 Subject: Use async_depth option on vaapi for much better encoding performance --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index ddbf95b..fab768d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -887,6 +887,8 @@ static void open_video_hardware(AVCodecContext *codec_context, VideoQuality vide } else { // TODO: More quality options //av_dict_set_int(&options, "low_power", 1, 0); + // Improves performance but increases vram + av_dict_set_int(&options, "async_depth", 8, 0); if(codec_context->codec_id == AV_CODEC_ID_H264) { // TODO: @@ -3389,7 +3391,7 @@ int main(int argc, char **argv) { const int64_t expected_frames = std::round((this_video_frame_time - record_start_time) / target_fps); int num_frames = std::max((int64_t)0LL, expected_frames - video_pts_counter); const double num_frames_seconds = num_frames * target_fps; - if((damaged || num_frames_seconds >= damage_timeout_seconds) && !paused/* && fps_counter < fps + 100*/) { + if((damaged || (framerate_mode == FramerateMode::CONSTANT && num_frames > 0) || (framerate_mode != FramerateMode::CONSTANT && num_frames_seconds >= damage_timeout_seconds)) && !paused) { gsr_damage_clear(&damage); if(capture->clear_damage) capture->clear_damage(capture); -- cgit v1.2.3