fix: decoder bug
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-06-11 23:58:44 +01:00
parent 470af79a24
commit b6c12de685
4 changed files with 10 additions and 4 deletions

2
Cargo.lock generated
View File

@ -1070,7 +1070,7 @@ dependencies = [
[[package]]
name = "ffmpeg-rs-raw"
version = "0.1.0"
source = "git+https://git.v0l.io/Kieran/ffmpeg-rs-raw.git?rev=928ab9664ff47c1b0bd8313ebc73d13b1ab43fc5#928ab9664ff47c1b0bd8313ebc73d13b1ab43fc5"
source = "git+https://git.v0l.io/Kieran/ffmpeg-rs-raw.git?rev=aa1ce3edcad0fcd286d39b3e0c2fdc610c3988e7#aa1ce3edcad0fcd286d39b3e0c2fdc610c3988e7"
dependencies = [
"anyhow",
"ffmpeg-sys-the-third",

View File

@ -44,7 +44,7 @@ http-range-header = { version = "0.4.2" }
base58 = "0.2.0"
libc = { version = "0.2.153", optional = true }
ffmpeg-rs-raw = { git = "https://git.v0l.io/Kieran/ffmpeg-rs-raw.git", rev = "928ab9664ff47c1b0bd8313ebc73d13b1ab43fc5", optional = true }
ffmpeg-rs-raw = { git = "https://git.v0l.io/Kieran/ffmpeg-rs-raw.git", rev = "aa1ce3edcad0fcd286d39b3e0c2fdc610c3988e7", optional = true }
candle-core = { git = "https://git.v0l.io/huggingface/candle.git", tag = "0.8.1", optional = true }
candle-nn = { git = "https://git.v0l.io/huggingface/candle.git", tag = "0.8.1", optional = true }
candle-transformers = { git = "https://git.v0l.io/huggingface/candle.git", tag = "0.8.1", optional = true }

View File

@ -105,7 +105,12 @@ impl WebpProcessor {
let mut decoder = Decoder::new();
decoder.setup_decoder(image_stream, None)?;
while let Ok((mut pkt, _stream)) = input.get_packet() {
while let Ok((mut pkt, _)) = input.get_packet() {
// skip packets not in the image stream
if (*pkt).stream_index != image_stream.index as i32 {
av_packet_free(&mut pkt);
continue;
}
let mut frame_save: *mut AVFrame = ptr::null_mut();
for (mut frame, _stream) in decoder.decode_pkt(pkt)? {
if frame_save.is_null() {

View File

@ -423,7 +423,8 @@ pub async fn get_blob_thumb(
if !thumb_file.exists() {
let mut p = WebpProcessor::new();
if p.thumbnail(&file_path, &thumb_file).is_err() {
if let Err(e) = p.thumbnail(&file_path, &thumb_file) {
warn!("Failed to generate thumbnail: {}", e);
return Err(Status::InternalServerError);
}
};