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

SupportedStreamConfig(Range) API inconsistencies - can we have a `SupportedStreamConfig.try_with_fixed_buffer_size`?

Đang mở
#956 2 bình luận 4 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
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
api, audio-video-rtc

Hướng nghiên cứu

Start by reading the definitions and conversion methods for SupportedStreamConfigRange, SupportedStreamConfig, and StreamConfig, then check issue #401 for context on the default buffer size behavior. The proposed starting point is a try_with_fixed_buffer_size method on SupportedStreamConfig; determine how it should interact with the existing buffer size range and configuration conversions. Done means the API lets callers narrow the buffer size and the documentation accurately describes the available methods.

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

Mô tả

The SupportedStreamConfigRange, SuportedStreamConfig and StreamConfig types make configuring streams in cpal far more complicated and unpleasant than it would need to be.

  • SupportedStreamConfigRange - range of sampling rates and buffer sizes
  • SupportedStreamConfig - fixed sampling rate, range of buffer sizes
  • StreamConfig - fixed sampling rate, fixed or 'default' buffer size

I'm not sure why there's even a need for SupportedStreamConfig, but the main point why I opened this issue is that the naively expected chain of Iterator<SupportedStreamConfigRange> -> SupportedStreamConfigRange -> SupportedStreamConfig -> StreamConfig is incomplete.

  • I get the iterator, and filter it to get one or more candidates.
  • Then on those, I call try_with_sample_rate to get a SupportedStreamConfig. This is where the first problem is: bad documentation: /// Retrieve a [SupportedStreamConfig] with the given sample rate and buffer size. The signature of the method is (self, sample_rate: SampleRate), no buffer size I could specify.
  • Getting a SupportedStreamConfig, I'd then like to narrow down the buffer size, as at least on Linux, most devices return with a buffer size range of between 1 and MAXINT32 or so. However, there is no method for doing this. As mentioned in #401, the config method on this type just returns a StreamConfig with a Default buffersize setting.

So in the end, I'm still hand-assembling a StreamConfig.

I guess the first step would be to have a try_with_fixed_buffer_size method on SupportedStreamConfig. Then, if there's no good reason for it, it might be meaningful to roll SupportedStreamConfigRange and SupportedStreamConfig into a single type?

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

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.