Give the stream API core-owned types
Command and Event no longer carry voelin-stream's types. voelin-core owns StreamInfo, ViewerInfo, StreamSetup, StreamKind, ViewerState, EndReason and LeaveReason (stream_types.rs) with u16 client ids, a viewer's SRTP profile as its name and its codec as voelin_media::Codec; stream.rs converts at the boundary. Command::SetSrtpProfiles takes profile names, which the stream task parses. EncodedFrame, LayerSpec, LayerId and LayerSet move into voelin-media (stream::EncodedFrame, layer); voelin-stream depends on it and re-exports them, so the engine, the stream sessions and voelinctl share one type. The crate is now a plain dependency of voelin-core (feature media keeps the module and WHIP), and its str0m feature is gone with str0m always there. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b0f95a384f
commit
da372dfe10
28 files changed
+798
-342
No files matched your search
+5
-3
@@ -20,10 +20,12 @@ described in [studio.md](studio.md).
|
||||
| `FrameRef { width, height, timestamp, pixels: PixelsRef }` | the same with borrowed planes (`PlaneRef { data: &[u8], stride }`), e.g. a mapped capture buffer; `VideoFrame::view()`, `FrameRef::to_frame()` |
|
||||
| `AudioBuffer { samples, channels, timestamp }` | interleaved `f32`, 48 kHz |
|
||||
| `convert::to_rgba(&frame, out, stride)`, `to_rgba_vec`, `to_i420`, `psnr` | BT.601 limited range (the WebRTC default). `to_rgba` writes straight into a Slint `SharedPixelBuffer<Rgba8Pixel>` (`make_mut_bytes()`, stride `width * 4`) |
|
||||
| `Codec` | `Vp8`, `Vp9`, `H264`, `Av1`; `FromStr` for SDP/MIME names; `From`/`TryFrom` `str0m::format::Codec` with feature `str0m` |
|
||||
| `Codec` | `Vp8`, `Vp9`, `H264`, `Av1`; `FromStr` for SDP/MIME names; `From`/`TryFrom` `str0m::format::Codec` |
|
||||
| `VideoEncoder` | `encode(&frame, force_keyframe) -> Vec<EncodedFrame>`; `encode_with(&frame, force_keyframe, &mut |EncodedChunk| ..)` hands out the encoder's own buffer (no copy); `set_bitrate(bps)` (libvpx: in place, no keyframe), `set_fps`, `speed()`, `codec()`, `backend()`; `gpu_alignment()` / `encode_gpu(&GpuFrame, ..)` for encoders that take frames in GPU memory (VA-API; MediaCodec's surface path on Android) |
|
||||
| `GpuFrame` | a picture in GPU memory (an NV12 VA-API surface), made by `ffmpeg::GpuConverter` from a captured DMA-BUF; `width`, `height`, `timestamp`, `at(timestamp)` (the same surface at another time). On Android `rendered(width, height, timestamp)`: a screen picture the virtual display renders straight into MediaCodec's input surface, only its size and time travel |
|
||||
| `EncodedFrame { data, keyframe, pts_90khz }` | one frame for `Peer::write` |
|
||||
| `EncodedFrame { data, keyframe, pts_90khz }` | one frame as an encoder makes it |
|
||||
| `stream::EncodedFrame { kind, time, data, layer, keyframe }` | one frame of a stream, ready to send: the encoder's frame with its media kind, RTP time (90 kHz video, 48 kHz Opus) and simulcast layer. What `StreamSink::send` and `Command::SendStreamFrame` take; `voelin-stream` passes the same type on to its peers |
|
||||
| `LayerSpec`, `LayerId`, `LayerSet` (`layer`) | the simulcast layers of a stream: size or scale, frame-rate cap, start, maximum and minimum bitrate, RID; `LayerSet` is a set of layer ids (e.g. those waiting for a keyframe). Owned here, used as they are by `voelin-stream` and the engine's API |
|
||||
| `VideoDecoder` | `decode(&[u8]) -> Option<VideoFrame>` (timestamp zero; the caller knows the RTP time); `decode_into(&[u8], &mut VideoFrame) -> bool` reuses the frame's buffers (FFmpeg's decoders: no allocation per picture); `conceals_errors()` (FFmpeg's H.264 and HEVC: frames after a lost one still decode) |
|
||||
| `EncoderConfig { fps, bitrate_bps, keyframe_interval, content, threads, speed }` | resolution follows the frames; a size change restarts with a keyframe; `threads` is a maximum (0: all CPUs but one), still capped at one per 320x240 pixels; `speed: None` adapts libvpx `cpu-used` to the encode time |
|
||||
| `Codecs` | `new()` (probes FFmpeg / MediaCodec once per process), `builtin()` (compiled-in codecs only), `with_openh264(lib)`, `with_preference(EncoderPreference)` / `set_preference`, `decoders()` (viewer order: every codec one decoder here decodes), `decoders_for(codec)` (that codec's decoders, best first: the ladder), `with_decoder_preference(DecoderPreference)` / `set_decoder_preference`, `with_decoder(factory)` (an application's decoder, first), `encoders()` / `encoder_codecs()` (streamer order under the preference), `encoders_for(&pref)`, `new_decoder(codec)` (the first of the ladder that opens), `new_decoder_with(codec, DecoderBackend)`, `new_encoder(codec, config)`, `new_encoder_preferring(codec, config, &pref)`, `new_encoder_with(codec, backend, config)`, `pick_encoder(&accepted)`, `is_hardware(backend)`, `report()`; cheap to clone |
|
||||
@@ -125,7 +127,7 @@ viewer: Engine::subscribe_frames ─ VideoPipeline (thread) ─ VideoDecoder
|
||||
portal maps it, and a conversion that fails turns the GPU path off for
|
||||
the capture (`StreamerStats::gpu_error`). Nothing is allocated per frame
|
||||
on this path either (the surfaces' frames are recycled).
|
||||
- Simulcast: `StreamerConfig::layers` (`voelin_stream::LayerSpec`; empty:
|
||||
- Simulcast: `StreamerConfig::layers` (`voelin_media::LayerSpec`; empty:
|
||||
one layer 0 at `bitrate_kbps`) are all encoded, each with its own encoder
|
||||
at `output_size()` of the source, its own frame-rate cap (`max_fps`,
|
||||
paced by timestamps) and its share of the CPUs. Frames carry `layer` and
|
||||
|
||||
Reference in new issue
Block a user