From 4daaa1f089a90ae17a7521d51ea126ffde9d38da Mon Sep 17 00:00:00 2001 From: Elia Zammuto Date: Wed, 31 Mar 2021 14:11:21 +0200 Subject: [PATCH] Added some keyframes --- pre-compiled | 2 +- sunshine/video.cpp | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pre-compiled b/pre-compiled index d1684dde..5c1e48af 160000 --- a/pre-compiled +++ b/pre-compiled @@ -1 +1 @@ -Subproject commit d1684ddea51a9baee94fcef806686de6017e982b +Subproject commit 5c1e48af98de9ee415e5c102861eb8115a457204 diff --git a/sunshine/video.cpp b/sunshine/video.cpp index 1557adbd..97148360 100644 --- a/sunshine/video.cpp +++ b/sunshine/video.cpp @@ -321,9 +321,11 @@ static encoder_t amdvce { { { { "quality"s, &config::video.amd.quality }, - { "rc"s, &config::video.amd.rc } + { "rc"s, "1"s }, + {"log_to_dbg"s,"1"s}, + {"gops_per_idr","1"s} }, - std::nullopt, std::make_optional({"qp"s, &config::video.qp}), + std::nullopt, std::nullopt, "h264_amf"s }, false, @@ -769,7 +771,7 @@ void encode_run( if(idr_events->peek()) { session->frame->pict_type = AV_PICTURE_TYPE_I; - + session->frame->key_frame = 1; auto event = idr_events->pop(); if(!event) { return; @@ -781,6 +783,7 @@ void encode_run( } else if(frame_nr == key_frame_nr) { session->frame->pict_type = AV_PICTURE_TYPE_I; + session->frame->key_frame = 1; } std::this_thread::sleep_until(next_frame); @@ -919,6 +922,7 @@ encode_e encode_run_sync(std::vector> &synce if(ctx->idr_events->peek()) { pos->session.frame->pict_type = AV_PICTURE_TYPE_I; + pos->session.frame->key_frame = 1; auto event = ctx->idr_events->pop(); auto end = event->second; @@ -928,6 +932,7 @@ encode_e encode_run_sync(std::vector> &synce } else if(ctx->frame_nr == ctx->key_frame_nr) { pos->session.frame->pict_type = AV_PICTURE_TYPE_I; + pos->session.frame->key_frame = 1; } if(img_tmp) { @@ -1120,6 +1125,7 @@ bool validate_config(std::shared_ptr &disp, const encoder_t &e encoder.img_to_frame(*hwdevice->img, session->frame); session->frame->pict_type = AV_PICTURE_TYPE_I; + session->frame->key_frame = 1; auto packets = std::make_shared(30); if(encode(1, session->ctx, session->frame, packets, nullptr)) {