Merge branch 'main' into dev

# Conflicts:
#	libs/hwcodec/cpp/common/util.cpp
#	libs/hwcodec/cpp/ffmpeg_ram/ffmpeg_ram_encode.cpp
This commit is contained in:
mofeng-git
2026-07-14 23:43:27 +08:00
2 changed files with 55 additions and 6 deletions

View File

@@ -359,7 +359,26 @@ struct CodecOptions {
};
bool set_rate_control(AVCodecContext *c, const std::string &name, int rc,
int /*q*/) {
int q) {
if (name.find("vaapi") != std::string::npos && rc == RC_CQ) {
// Used only after the normal bitrate-based VAAPI initialization fails.
// Some drivers, including Intel iHD on Jasper Lake, expose CQP as their
// only compatible rate-control mode.
c->bit_rate = 0;
c->rc_min_rate = 0;
c->rc_max_rate = 0;
c->rc_buffer_size = 0;
c->rc_initial_buffer_occupancy = 0;
const int qp = q > 0 ? q : 23;
const int ret = av_opt_set_int(c->priv_data, "qp", qp, 0);
if (ret < 0) {
LOG_ERROR(std::string("vaapi set qp failed, ret = ") +
av_err2str(ret));
return false;
}
return true;
}
if (name.find("qsv") != std::string::npos) {
// https://github.com/LizardByte/Sunshine/blob/3e47cd3cc8fd37a7a88be82444ff4f3c0022856b/src/video.cpp#L1635
c->strict_std_compliance = FF_COMPLIANCE_UNOFFICIAL;