From 637e4d452eb37142ae456aee40ba150cb5d0c06a Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 10 Mar 2023 18:23:23 +0100 Subject: [PATCH] pass null frames to the encoder without attempting to convert them --- src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 191a8a6..5e00cf0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -706,7 +706,10 @@ println!("can't generate default channel map for {} channels", dainfo.channels); fn encode_frame(dst_id: u32, encoder: &mut Box, cvt: &mut OutputConvert, frm: NAFrameRef, scale_opts: &[(String, String)]) -> bool { let buf = frm.get_buffer(); - let cbuf = match cvt { + let cbuf = if let NABufferType::None = buf { + buf + } else { + match cvt { OutputConvert::None => buf, OutputConvert::Video(ref mut scaler, ref mut dbuf) => { let cur_ifmt = get_scale_fmt_from_pic(&buf); @@ -735,7 +738,8 @@ fn encode_frame(dst_id: u32, encoder: &mut Box, cvt: &mut OutputC } ret.unwrap() }, - }; + } + }; let cfrm = NAFrame::new(frm.get_time_information(), frm.frame_type, frm.key, frm.get_info(), cbuf); encoder.encode(&cfrm).unwrap(); true -- 2.39.5