feat: Add Max Bitrate option (#3628)

This commit is contained in:
Utkarsh Dalal 2025-02-10 01:30:29 +05:30 committed by GitHub
commit 3a88ddc639
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 37 additions and 2 deletions

View file

@ -509,7 +509,8 @@ namespace config {
{} // wa
}, // display_device
1 // min_fps_factor
1, // min_fps_factor
0 // max_bitrate
};
audio_t audio {
@ -1138,6 +1139,7 @@ namespace config {
bool_f(vars, "dd_wa_hdr_toggle", video.dd.wa.hdr_toggle);
int_between_f(vars, "min_fps_factor", video.min_fps_factor, {1, 3});
int_f(vars, "max_bitrate", video.max_bitrate);
path_f(vars, "pkey", nvhttp.pkey);
path_f(vars, "cert", nvhttp.cert);

View file

@ -138,6 +138,7 @@ namespace config {
} dd;
int min_fps_factor; // Minimum fps target, determines minimum frame time
int max_bitrate; // Maximum bitrate, sets ceiling in kbps for bitrate requested from client
};
struct audio_t {

View file

@ -1687,7 +1687,8 @@ namespace video {
}
}
auto bitrate = config.bitrate * 1000;
auto bitrate = ((config::video.max_bitrate > 0) ? std::min(config.bitrate, config::video.max_bitrate) : config.bitrate) * 1000;
BOOST_LOG(info) << "Max bitrate is " << config::video.max_bitrate;
ctx->rc_max_rate = bitrate;
ctx->bit_rate = bitrate;