Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#956 2 comentarios 4 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
rust

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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?

Lenguaje dominante
Rust
Estrellas
4k
Forks
554
Merge medio
3 d 3 h
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de RustAudio/cpal

Todos los issues de RustAudio/cpal

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.