From b76448d99f7c994787b8f6385d50bb62d3ba8217 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 16 May 2023 18:13:11 +0200 Subject: [PATCH] duplicate last frame when the encoder does not support skip frames --- src/main.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index ff19ae1..1e77521 100644 --- a/src/main.rs +++ b/src/main.rs @@ -743,10 +743,16 @@ fn encode_frame(dst_id: u32, encoder: &mut Box, cvt: &mut OutputC let buf = frm.get_buffer(); let cbuf = if let NABufferType::None = buf { if (encoder.get_capabilities() & ENC_CAPS_SKIPFRAME) == 0 { - println!("encoder does not support skip frames, skipping"); - return true; + match cvt { + OutputConvert::Video(_, ref mut dbuf) => dbuf.clone(), + _ => { + println!("encoder does not support skip frames, skipping"); + return true; + }, + } + } else { + buf } - buf } else { match cvt { OutputConvert::None => buf, -- 2.30.2