Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

ALSA backend with pipwire-alsa buffer length mismatch causing xruns

Đang mở
#1,390 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
audio-video-rtc

Hướng nghiên cứu

Start with the linked reproduction repository’s README and the CPAL ALSA backend’s buffer size handling; reproduce the reported xrun with the beep example and PipeWire quantum set to 2048. Compare default and explicit buffer sizes against the observations in the issue. Done when the backend avoids the reported underruns in the described setup or documents a clear supported workaround.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

host - alsa platform - linux

Repro repo with a detailed README: https://github.com/karolinepauls/cpal-alsa-buffer-repro

Problem: The existing "beep" example can produce a choppy sound when run over pipewire-alsa, and so can any other code that leaves the buffer size setting default. I've reproduced it with kira (which uses CPAL with ALSA) as well as my private sound engine using CPAL's ALSA backend. In all those cases, I've had constant underruns producing audio glitches.

I believe this is ultimately a pipewire-alsa problem. Still CPAL needs to help users avoid it. Could we

A) somehow read the actual buffer size used by the device and use that?
B) or at least suggest against using BufferSize::Default and set it to e.g.:

    let buffer_size = if let &SupportedBufferSize::Range { min, max } = default_config.buffer_size()
    {
        2048.clamp(min, max)
    } else {
        2048
    };

Abbreviated repro

  1. Start pw-top in background to monitor the quanta.

  2. Lock device quantum, as if another running application caused the quantum to be set (e.g. Firefox playing a video).

pw-metadata -n settings 0 clock.force-quantum 2048
  1. Run, requesting default buffer size:
cargo run

Result: running with a buffer size of 512, choppy sound.

  1. Run, requesting an explicit buffer size of 512:
cargo run -- --buffer-size 512

Same effect.

  1. Run, requesting a buffer size of at least 1024:
cargo run -- --buffer-size 1024

Result: clean sine.

  1. Run with a buffer size of 512 but also ensure that pipewire runs with it.
pw-metadata -n settings 0 clock.force-quantum 512
cargo run -- --buffer-size 512

Result: clean sine.

Observations

For some reason an app buffer size of 512 doesn't work with a device buffer size of 2048. At least with pipewire-alsa.

app device result
512 512 ok
default 2048 xrun
512 2048 xrun
1024 2048 ok
2048 2048 ok

Versions

pipewire:

Compiled with libpipewire 1.6.2
Linked with libpipewire 1.6.2

Kubuntu 26.04.1 LTS

CPAL: git 79275c2313da30e9f8b1ad8168385d091a2c9ada (current master).

Ngôn ngữ chính
Rust
Star
4k
Fork
554
Merge trung bình
2 ngày 11 giờ
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của RustAudio/cpal

Tất cả issue của RustAudio/cpal

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.