Skip to content

Commit 92084c5

Browse files
committed
revised unwrap/expect
1 parent 43fbdb4 commit 92084c5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,18 @@ fn handle(params: HandleParams) -> anyhow::Result<()> {
335335
raw_frames
336336
} else {
337337
vec![(
338-
p.data().unwrap().to_vec(),
338+
p.data().unwrap_or(&[]).to_vec(),
339339
video_decoder.width(),
340340
video_decoder.height(),
341341
)]
342342
};
343343

344344
for (raw_frame, width, height) in raw_frames {
345345
let codec = if !decode {
346-
String::from(video_decoder.codec().unwrap().name())
346+
match video_decoder.codec() {
347+
Some(c) => String::from(c.name()),
348+
None => bail!("Unable to get codec name"),
349+
}
347350
} else {
348351
String::from(Id::RAWVIDEO.name())
349352
};
@@ -434,6 +437,7 @@ fn assign_log_level(ffmpeg_log_level: FFmpegLogLevel) -> Level {
434437

435438
#[pymethods]
436439
impl FFMpegSource {
440+
#[allow(clippy::too_many_arguments)]
437441
#[new]
438442
#[pyo3(signature = (uri, params,
439443
queue_len = 32,

0 commit comments

Comments
 (0)