Skip to content

Commit

Permalink
Good error message on too big resolution.
Browse files Browse the repository at this point in the history
  • Loading branch information
algesten authored and ralfbiedert committed Apr 4, 2024
1 parent 6e1fc69 commit 4bf566a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions openh264/src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,16 @@ impl Encoder {
}

fn reinit(&mut self, width: i32, height: i32) -> Result<(), Error> {
// https://github.com/cisco/openh264/blob/master/README.md
// > Encoder errors when resolution exceeds 3840x2160
//
// Some more detail here:
// https://github.com/cisco/openh264/issues/3553
// > Currently the encoder/decoder could only support up to level 5.2,
if width > 3840 || height > 2160 {
return Err(Error::msg("Encoder max resolution 3840x2160"));
}

let mut params = SEncParamExt::default();

unsafe { self.raw_api.get_default_params(&mut params).ok()? };
Expand Down

0 comments on commit 4bf566a

Please sign in to comment.