fix: negative duration

This commit is contained in:
kieran 2025-01-27 22:57:16 +00:00
parent ceca1904d7
commit 4f40efa99c
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
2 changed files with 8 additions and 2 deletions

View File

@ -106,7 +106,9 @@ impl FileStore {
v_stream.map(|v| v.width as u32), v_stream.map(|v| v.width as u32),
v_stream.map(|v| v.height as u32), v_stream.map(|v| v.height as u32),
mime, mime,
probe.as_ref().map(|p| p.duration), probe
.as_ref()
.map(|p| if p.duration < 0. { 0.0 } else { p.duration }),
probe.as_ref().map(|p| p.bitrate as u32), probe.as_ref().map(|p| p.bitrate as u32),
) )
} }

View File

@ -66,7 +66,11 @@ impl WebpProcessor {
mime_type: "image/webp".to_string(), mime_type: "image/webp".to_string(),
width: image_stream.width, width: image_stream.width,
height: image_stream.height, height: image_stream.height,
duration: probe.duration, duration: if probe.duration < 0. {
0.
} else {
probe.duration
},
bitrate: probe.bitrate as u32, bitrate: probe.bitrate as u32,
}) })
} }