diff options
author | metamuffin <metamuffin@disroot.org> | 2023-12-11 23:15:47 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-12-11 23:15:47 +0100 |
commit | 0a3a9c7f0dba968adfd8a716cfb8287cc74cb5d2 (patch) | |
tree | 65dcd2587e601974b3ab0c7305ebd016eb4d9a92 /transcoder/src | |
parent | a29e087fe0d0b06a99ff865a2bf8eb09f6a734de (diff) | |
download | jellything-0a3a9c7f0dba968adfd8a716cfb8287cc74cb5d2.tar jellything-0a3a9c7f0dba968adfd8a716cfb8287cc74cb5d2.tar.bz2 jellything-0a3a9c7f0dba968adfd8a716cfb8287cc74cb5d2.tar.zst |
different limit for image transcodes
Diffstat (limited to 'transcoder/src')
-rw-r--r-- | transcoder/src/image.rs | 4 | ||||
-rw-r--r-- | transcoder/src/lib.rs | 3 | ||||
-rw-r--r-- | transcoder/src/snippet.rs | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/transcoder/src/image.rs b/transcoder/src/image.rs index 7f52ff3..e1ba9b0 100644 --- a/transcoder/src/image.rs +++ b/transcoder/src/image.rs @@ -1,4 +1,4 @@ -use crate::LOCAL_TRANSCODING_TASKS; +use crate::LOCAL_IMAGE_TRANSCODING_TASKS; use anyhow::Context; use image::imageops::FilterType; use jellybase::{cache::async_cache_file, AssetLocationExt}; @@ -26,7 +26,7 @@ pub async fn transcode( &format!("{width} {quality} {speed}"), ], move |mut output| async move { - let _permit = LOCAL_TRANSCODING_TASKS.acquire().await?; + let _permit = LOCAL_IMAGE_TRANSCODING_TASKS.acquire().await?; info!("encoding {asset:?} (speed={speed}, quality={quality}, width={width})"); let encoded = tokio::task::spawn_blocking(move || { let original_path = asset.path(); diff --git a/transcoder/src/lib.rs b/transcoder/src/lib.rs index ef663fb..d540e57 100644 --- a/transcoder/src/lib.rs +++ b/transcoder/src/lib.rs @@ -11,4 +11,5 @@ pub mod image; pub mod snippet; pub mod subtitles; -static LOCAL_TRANSCODING_TASKS: Semaphore = Semaphore::const_new(2); +static LOCAL_IMAGE_TRANSCODING_TASKS: Semaphore = Semaphore::const_new(8); +static LOCAL_VIDEO_TRANSCODING_TASKS: Semaphore = Semaphore::const_new(2); diff --git a/transcoder/src/snippet.rs b/transcoder/src/snippet.rs index 50f5a82..5da1ae7 100644 --- a/transcoder/src/snippet.rs +++ b/transcoder/src/snippet.rs @@ -4,7 +4,7 @@ Copyright (C) 2023 metamuffin <metamuffin.org> */ -use crate::LOCAL_TRANSCODING_TASKS; +use crate::LOCAL_VIDEO_TRANSCODING_TASKS; use jellybase::cache::async_cache_file; use jellycommon::{jhls::EncodingProfile, AssetLocation}; use log::{debug, info}; @@ -25,7 +25,7 @@ pub async fn transcode( Ok(async_cache_file( &["snip-tc", key, &format!("{enc:?}")], move |mut output| async move { - let _permit = LOCAL_TRANSCODING_TASKS.acquire().await?; + let _permit = LOCAL_VIDEO_TRANSCODING_TASKS.acquire().await?; debug!("transcoding snippet {key}"); let mut args = Vec::new(); |