Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize AsyncVideoDecoder for Better Memory + Switch to Bounded Channels (Possible memory leak fix) #122

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ use tauri_nspanel::ManagerExt;
use tauri_plugin_notification::PermissionState;
use tauri_plugin_shell::ShellExt;
use tauri_specta::Event;
use tokio::sync::watch;
use tokio::sync::mpsc;
use tokio::task;
use tokio::{
sync::{Mutex, RwLock},
Expand Down Expand Up @@ -736,7 +738,9 @@ async fn render_to_file_impl(
let decoders = editor_instance.decoders.clone();
let options = editor_instance.render_constants.options.clone();

let (tx_image_data, mut rx_image_data) = tokio::sync::mpsc::unbounded_channel::<Vec<u8>>();
// Change this to be whatever is the most ideal for certain processors
let buffer_size = 60 * 3; // 3 seconds at 60 fps, or 6 seconds at 30 fps
let (tx_image_data, mut rx_image_data) = mpsc::channel::<Vec<u8>>(buffer_size);// Adjust buffer size as needed

let output_folder = output_path.parent().unwrap();
std::fs::create_dir_all(output_folder)
Expand Down
1 change: 1 addition & 0 deletions crates/rendering/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ ffmpeg.workspace = true
lru = "0.12.4"
ffmpeg-sys-next.workspace = true
futures = "0.3.30"
num_cpus = "1.13.1"
Loading
Loading