Refuse streams without a common codec; voelinctl streams VP8 by default

On a machine with hardware encoders, voelinctl's streamer chose H.264
(the first hardware codec) and, sending through a FrameSource, offered
it alone. A viewer that cannot decode H.264 (no OpenH264 library)
answered with a video section that listed no payload type at all; the
streamer could not parse that answer and dropped the viewer, which only
saw "removed by the streamer (Failed)".

A viewer now refuses such an offer with the codecs on both sides, and
voelinctl's single-codec offer defaults to VP8, which every client
decodes; --codec or a named --encoder still pick another. The engine's
own streams are unaffected: they offer several codecs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 06:35:32 +03:00
1 parent 48a4ffc63f
commit 7a3f5b0436
2 files changed
+46 -7

No files matched your search

+6 -3
View File
@@ -14,7 +14,7 @@ use tokio::time::{Instant, Interval, sleep_until};
use tsclientlib::prelude::*;
use tsclientlib::{ClientId, Connection, MessageHandle, StreamItem};
use voelin_core::media::voelin_media::capture::SourceId;
use voelin_core::media::voelin_media::{Codecs, VideoFrame, convert};
use voelin_core::media::voelin_media::{Codec, Codecs, VideoFrame, convert};
use voelin_core::media::{
CaptureBackend, EncodedSource, EncoderPreference, Latest, Streamer, StreamerConfig,
VideoPipeline, peer_config, preferred_codec, stream_codec, video_codec,
@@ -96,8 +96,8 @@ pub enum StreamCommand {
/// bitrate, no encoder) instead of capturing.
#[arg(long, conflicts_with_all = ["source", "synthetic"])]
placeholder: bool,
/// Video codec: vp8, vp9, h264, av1 [default: the first the encoder
/// choice gives: hardware first, else VP8].
/// Video codec: vp8, vp9, h264, av1 [default: VP8, which every client
/// decodes; with --encoder, that encoder's codec]. One codec is offered.
#[arg(long)]
codec: Option<String>,
/// Encoder: `auto`, `software` or a backend name from `voelinctl
@@ -177,6 +177,9 @@ pub async fn run(con: &mut Connection, args: &StreamArgs) -> Result<()> {
} else {
let configured = match codec {
Some(codec) => Some(codec.parse().map_err(|e| anyhow::anyhow!("{e}"))?),
// One codec is offered (below): by default the one every
// client decodes. A named encoder brings its own codec.
None if encoder == "auto" => Some(Codec::Vp8),
None => None,
};
if let Some(codec) = preferred_codec(&codecs, configured) {