Expand description
Native audio capture, encoding, and decoding for Media over QUIC.
Counterpart to moq-video for audio
tracks, and shaped the same way. Sits on top of moq_mux and hang and
adds the missing piece for native callers: Rust-native Opus and uncompressed
PCM codecs that turn raw samples into HANG audio tracks and back.
capturedescribes an audio source (capture::Config) and grabs buffers per platform: a microphone via cpal (CoreAudio / WASAPI / ALSA) everywhere, or macOS system audio via ScreenCaptureKit.capture::Sourcepicks between them andcapture::deviceslists the inputs and hands back the ids it takes. Requires thecapturefeature, so these names are unlinked here: they don’t exist in a default build.encodeencodes PCM and publishes it throughmoq_mux::container, registering the rendition in thehangcatalog. Two entry points:encode::publish_capturecaptures a microphone and publishes it (turnkey). It encodes strictly on demand: the track and catalog are advertised up front, but the device opens only while a subscriber is listening and is released when the last one leaves.encode::Producerpublishes PCM you hand it.
decodesubscribes to an encoded track and decodes it back to PCM.decode::Consumeris the mirror ofencode::Producer.
Format mirrors WebCodecs AudioData.format; the helpers convert between
any supported layout and the interleaved f32 representation libopus
expects. Frame is a thin owned buffer: a timestamp and a payload. PCM
layout lives on the producer / consumer via encode::Input /
decode::Config, not on each frame, so callers can’t drift between calls.
Modules§
- decode
- Subscribe to an encoded audio track and decode it to raw PCM.
- encode
- Encode raw PCM and publish it as a moq audio track.
Structs§
- Frame
- One unit of raw PCM crossing the codec boundary: what
encode::Producer::writetakes and whatdecode::Consumer::readreturns. - Resampler
- Sample-rate converter over interleaved
f32PCM.