MCPcopy Index your code
hub / github.com/Recordscript/recordscript / encode_to_message

Method encode_to_message

libs/scrap/src/common/vpxcodec.rs:186–204  ·  view source on GitHub ↗
(&mut self, input: EncodeInput, ms: i64)

Source from the content-addressed store, hash-verified

184 }
185
186 fn encode_to_message(&mut self, input: EncodeInput, ms: i64) -> ResultType<VideoFrame> {
187 let mut frames = Vec::new();
188 for ref frame in self
189 .encode(ms, input.yuv()?, STRIDE_ALIGN)
190 .with_context(|| "Failed to encode")?
191 {
192 frames.push(VpxEncoder::create_frame(frame));
193 }
194 for ref frame in self.flush().with_context(|| "Failed to flush")? {
195 frames.push(VpxEncoder::create_frame(frame));
196 }
197
198 // to-do: flush periodically, e.g. 1 second
199 if frames.len() > 0 {
200 Ok(VpxEncoder::create_video_frame(self.id, frames))
201 } else {
202 Err(anyhow!("no valid frame"))
203 }
204 }
205
206 fn yuvfmt(&self) -> crate::EncodeYuvFormat {
207 self.yuvfmt.clone()

Callers

nothing calls this directly

Calls 3

yuvMethod · 0.80
encodeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected