Skip to content

Commit f6499ed

Browse files
committed
compress/openapv: Fail if both QP and bitrate are specified
1 parent 14d3f92 commit f6499ed

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/video_compress/openapv.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ bool state_video_compress_oapv::parse_fmt(char *fmt)
200200
return false;
201201
}
202202
cdsc.param[FRM_INDEX].qp = (unsigned char) qp;
203+
cdsc.param[FRM_INDEX].rc_type = OAPV_RC_CQP;
203204
} else if (IS_KEY_PREFIX(tok, "bitrate")) {
204205
const char *endptr = nullptr;
205206
long long br = unit_evaluate(val, &endptr);
@@ -214,7 +215,6 @@ bool state_video_compress_oapv::parse_fmt(char *fmt)
214215
// plain small number was given, treat as kbps directly
215216
cdsc.param[FRM_INDEX].bitrate = (int) br;
216217
}
217-
cdsc.param[FRM_INDEX].rc_type = OAPV_RC_ABR;
218218
} else if (IS_KEY_PREFIX(tok, "preset")) {
219219
const int preset = atoi(val);
220220
if (preset < OAPV_PRESET_FASTEST || preset > OAPV_PRESET_PLACEBO) {
@@ -407,6 +407,11 @@ void* openapv_compress_init(module */*parent*/, const char *opts) {
407407
free(fmt);
408408
}
409409

410+
if(s->cdsc.param->bitrate != 0 && s->cdsc.param->rc_type == OAPV_RC_CQP){
411+
log_msg(LOG_LEVEL_FATAL, MOD_NAME "QP and bitrate can't be set at the same time!\n");
412+
return nullptr;
413+
}
414+
410415
return s.release();
411416
}
412417

0 commit comments

Comments
 (0)