Skip to content

Commit

Permalink
Make max_keyframe_interval = 0 an error
Browse files Browse the repository at this point in the history
  • Loading branch information
YaLTeR committed Sep 3, 2019
1 parent 6b9f362 commit 74d90cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ impl Config {
if config.rdo_lookahead_frames > MAX_RDO_LOOKAHEAD_FRAMES {
return Err(EncoderStatus::Failure);
}
if config.max_key_frame_interval == 0 {
return Err(EncoderStatus::Failure);
}

if !check_tile_log2(config.tile_cols) {
return Err(EncoderStatus::Failure);
Expand Down
8 changes: 8 additions & 0 deletions src/api/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1662,3 +1662,11 @@ fn log_q_exp_overflow() {
ctx.receive_packet().unwrap();
let _ = ctx.receive_packet();
}

#[test]
fn max_key_frame_interval_zero() {
let mut config = Config::default();
config.enc.max_key_frame_interval = 0;
let res: Result<Context<u8>, _> = config.new_context();
assert!(res.is_err());
}

0 comments on commit 74d90cb

Please sign in to comment.