cpal + dioxus_desktop: eats memory and dies
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 32/100
Hướng nghiên cứu
Start by reproducing the memory spike with the minimal CPAL stream and Dioxus Desktop launch shown in the issue, then compare each program running alone. The payload names no repository files or tests and does not identify which library causes the interaction, so debugging will require tracing both libraries' startup paths. Done means the combined program opens its window without unbounded memory use while the audio stream runs.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
With latest versions:
cpal = { version = "0.15.2", features=["jack"] }
dioxus = "0.3.2"
dioxus-ssr = "0.3.0"
dioxus-desktop = "0.3.0"
Consider this minimal code:
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
use cpal::{BufferSize, Device, Stream, StreamConfig, SupportedBufferSize};
use std::cmp::max;
fn main() {
let _stream = start_cpal();
loop {}
}
fn start_cpal() -> Stream {
let device = get_device();
let config = get_config(&device);
let stream = device
.build_output_stream(
&config,
move |_: &mut [f32], _: &cpal::OutputCallbackInfo| {},
move |_| {},
None,
)
.unwrap();
stream.play().unwrap();
stream
}
fn get_device() -> Device {
let host_id = cpal::available_hosts()[0];
let host = cpal::host_from_id(host_id).unwrap();
host.default_output_device().unwrap()
}
fn get_config(device: &Device) -> StreamConfig {
let mut supported_configs_range = device.supported_output_configs().unwrap();
let supported_config = supported_configs_range
.next()
.unwrap()
.with_max_sample_rate();
let mut config = supported_config.config();
config.buffer_size = BufferSize::Fixed(get_some_buffer_size(supported_config.buffer_size()));
config
}
fn get_some_buffer_size(spec: &SupportedBufferSize) -> u32 {
match spec {
SupportedBufferSize::Range { min, .. } => max(*min, 64),
SupportedBufferSize::Unknown => 64,
}
}
It works as expected (program runs; nothing happens). I also get sound if I put something in the data callback.
Enter dioxus desktop:
fn main() {
let _stream = start_cpal();
dioxus_desktop::launch(app);
}
use dioxus::prelude::*;
fn app(cx: Scope) -> Element {
cx.render(rsx!("lol"))
}
// .. same code as before
Expected result: cpal still works; Dioxus window shows up.
Actual result: program eats all the memory and the OS kills it. No window shows up.
The start of the spike is where I run the program. It falls back down after a few seconds when the process is killed.
The issue is not with Dioxus alone, because this program works as expected:
fn main() {
dioxus_desktop::launch(app);
}
The problem only occurs when I use cpal and Dioxus in the same program.
I don't know if this is an issue with Dioxus or cpal, and I have no idea where to begin debugging this. Any ideas please?
I'm on Ubuntu 22.04.2 LTS. Lemme know if you need any other details. Thank you!!
- Ngôn ngữ chính
- Rust
- Star
- 4k
- Fork
- 554
- Merge trung bình
- 3 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của RustAudio/cpal
-
aaudio: dynamic buffer tuning never grows the buffer (set_buffer_size_in_frames reports Err on success)Có thể đã có người làm @dannyward630 đã nhận 3 ngày trước. Đang mởhost - aaudio platform - android
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
WebAudio wasm build fails with wasm-bindgen panic=unwind closuresCó thể đã có người làm @bogusyogi đã nhận 12 ngày trước. Đang mởhost - webaudio platform - web
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
RustAudio/cpal#1394 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
New WASAPI implementationĐang mởcode quality dependencies host - wasapi platform - windows
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
RustAudio/cpal#1416 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
host - pipewire platform - linux
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 52/100
RustAudio/cpal#1405 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
WASAPI: default-device activation fails with RPC_E_CHANGED_MODE after endpoint-notification callbacks put thread-pool threads into an STACó thể đã có người làm @dannyward630 đã nhận 4 ngày trước. Đang mởcorrectness host - wasapi platform - windows
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
RustAudio/cpal#1402 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của RustAudio/cpal
Issue tương tự
-
bug dependencies kind:fix priority: P3 ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
shep-pm/shep#1318 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
swc-project/swc-next#1165 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Alive24/shea-symphony#574 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày