use idr param & deal with narrowing conversion warns

This commit is contained in:
aomiki
2025-10-29 19:19:22 +01:00
committed by xytovl
parent 4908f50a00
commit 1635bdabce
2 changed files with 7 additions and 8 deletions
+6 -7
View File
@@ -130,16 +130,14 @@ static void check_profile_guid_supported(std::shared_ptr<video_encoder_nvenc_sha
} }
} }
NV_ENC_RC_PARAMS video_encoder_nvenc::get_rc_params(int bitrate) NV_ENC_RC_PARAMS video_encoder_nvenc::get_rc_params(uint64_t bitrate)
{ {
NV_ENC_RC_PARAMS rc_params{ return {
.rateControlMode = NV_ENC_PARAMS_RC_CBR, .rateControlMode = NV_ENC_PARAMS_RC_CBR,
.averageBitRate = bitrate, .averageBitRate = static_cast<uint32_t>(bitrate),
.vbvBufferSize = bitrate / fps, .vbvBufferSize = static_cast<uint32_t>(bitrate / fps),
.vbvInitialDelay = bitrate / fps, .vbvInitialDelay = static_cast<uint32_t>(bitrate / fps),
.multiPass = NV_ENC_TWO_PASS_QUARTER_RESOLUTION}; .multiPass = NV_ENC_TWO_PASS_QUARTER_RESOLUTION};
return rc_params;
} }
video_encoder_nvenc::video_encoder_nvenc( video_encoder_nvenc::video_encoder_nvenc(
@@ -432,6 +430,7 @@ std::optional<video_encoder::data> video_encoder_nvenc::encode(bool idr, std::ch
try try
{ {
NVENC_CHECK(shared_state->fn.nvEncReconfigureEncoder(session_handle, &reconfig_params)); NVENC_CHECK(shared_state->fn.nvEncReconfigureEncoder(session_handle, &reconfig_params));
idr = true;
U_LOG_I("nvenc: reconfiguring bitrate succeeded, new value: %d", bitrate); U_LOG_I("nvenc: reconfiguring bitrate succeeded, new value: %d", bitrate);
} }
catch (const std::exception & e) catch (const std::exception & e)
+1 -1
View File
@@ -55,7 +55,7 @@ private:
float fps; float fps;
int bytesPerPixel = 1; int bytesPerPixel = 1;
NV_ENC_RC_PARAMS get_rc_params(int bitrate); NV_ENC_RC_PARAMS get_rc_params(uint64_t bitrate);
public: public:
video_encoder_nvenc(wivrn_vk_bundle & vk, encoder_settings & settings, float fps, uint8_t stream_idx); video_encoder_nvenc(wivrn_vk_bundle & vk, encoder_settings & settings, float fps, uint8_t stream_idx);