From 4bf566a8ace0ddae67a4b688af8c9f2aa2775edb Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Thu, 4 Apr 2024 11:01:05 +0200 Subject: [PATCH] Good error message on too big resolution. --- openh264/src/encoder.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openh264/src/encoder.rs b/openh264/src/encoder.rs index d43b3a1..1daff6f 100644 --- a/openh264/src/encoder.rs +++ b/openh264/src/encoder.rs @@ -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()? };