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

[experiment] force chunking when using dynamic sources

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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
12/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust

Hướng nghiên cứu

The payload names no files, only the mixer's Box<dyn Source> storage and a sketched Chunked wrapper with a next method on Mixer. Start by finding where the mixer boxes its sources and how next() pulls samples, then benchmark the current path. Done would mean a measured comparison with a proposed design agreed in the thread, which is not yet settled.

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

Mô tả

enhancement

I suspect one thing that can really slow the mixer down is that it takes Box<dyn Source>. Since the next() calls cannot be inlined here this probably slows everything down. We can make this less of an issue by getting chunks (up to some size) in the mixer. Roughly:

impl source -> Sample
chunked(impl source) -> [Sample]    // returns array
Box<dyn chunked> -> [Sample]        // return array
Mixer() -> Sample (uses the chunks internally)

Now the only way to get a nice API with this is to hide the whole chunking inside the mixer. Like this:

struct Mixer {...}

impl Mixer {
    fn add(&mut self, s: impl Source) {
        let chunked = Chunked::from(s);
        let chunked = Box::new(chunked) as Box<dyn Chunk>;
        self.sources.push(chunked)
    }
    ...
}

impl Iterator for Mixer {
    fn next(&mut self) -> Option<Sample> {
        if self.cached_chunks.is_empty() {
             for chunked in self.sources {
                  self.cached_chunks.push(chunked.next_chunk())?;
             }
        }
        
        let mut sample = 0.0;
        for chunk in &mut self.cached_chunks {
            sample += chunk.pop_front();
        }
        Some(sample)
    }
}

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

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/rodio

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

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.