duplicate last frame when the encoder does not support skip frames
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 16 May 2023 16:13:11 +0000 (18:13 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 16 May 2023 16:13:11 +0000 (18:13 +0200)
src/main.rs

index ff19ae151f4eebed8f9bb64f20cf34f2a57aed5c..1e77521d4d6fce2e438dba03ef05d3c2c42122d6 100644 (file)
@@ -743,10 +743,16 @@ fn encode_frame(dst_id: u32, encoder: &mut Box<dyn NAEncoder>, 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,