Skip to content

🎥 Make videos programmatically with React

fix it

Jonny Burger6fdf44a1d49c
diff --git a/packages/renderer/rust/ffmpeg.rs b/packages/renderer/rust/ffmpeg.rs
index e6bb579ae4..09eb60b2d2 100644
--- a/packages/renderer/rust/ffmpeg.rs
+++ b/packages/renderer/rust/ffmpeg.rs
@@ -91,10 +91,10 @@ pub fn extract_frame(
if transparent != stream.transparent {
continue;
}
- if stream.last_position.is_some() && stream.last_position.unwrap() > max_stream_position {
+ if stream.last_position.unwrap_or(0) > max_stream_position {
continue;
}
- if stream.last_position.is_some() && stream.last_position.unwrap() < min_stream_position {
+ if stream.last_position.unwrap_or(0) < min_stream_position {
continue;
}
suitable_open_stream = Some(i);
diff --git a/packages/renderer/rust/opened_stream.rs b/packages/renderer/rust/opened_stream.rs
index 8fcb04449a..85bbd699ba 100644
--- a/packages/renderer/rust/opened_stream.rs
+++ b/packages/renderer/rust/opened_stream.rs
@@ -159,12 +159,8 @@ impl OpenedStream {
_ => self.duration_or_zero.min(position),
};
- let should_seek = match self.last_position {
- Some(last_position) => {
- position < last_position || last_position < calc_position(time - 3.0, time_base)
- }
- None => true,
- };
+ let should_seek = position < self.last_position.unwrap_or(0)
+ || self.last_position.unwrap_or(0) < calc_position(time - 3.0, time_base);
if should_seek {
_print_verbose(&format!(