RtspSrc is not an Element: every consumer writes the same AppSrc bridging task #50

Open
opened 2026-07-14 15:40:08 +00:00 by p13marc · 1 comment
p13marc commented 2026-07-14 15:40:08 +00:00 (Migrated from github.com)

RtspSrc is a config builder, not a pipeline element, so every consumer writes the same bridging task.

src/elements/rtp/rtsp.rs:278RtspSrc holds config; :362 connect() returns an RtspSession (:391). RtspSession does not implement Element — you pull from it with next_frame() and feed the result into an AppSrc by hand (see examples/58_rtsp_display.rs:83-107).

Every other source (V4l2Src, VideoTestSrc, ...) is a graph node you add_source() and link. RTSP is the odd one out, and the boilerplate — spawn a task, loop next_frame(), push into an AppSrc, handle EOS and reconnect — is identical for everyone who does it.

Ask

An Element source wrapping the session, so RTSP is add_source("rtsp", RtspSrc::new(url).connect()?) like everything else. Keep the manual RtspSession path for callers who want to own the pump.

Lowest priority of the batch — it's boilerplate, not a blocker. Filing it for completeness while the upstream asks are being collected.

`RtspSrc` is a config builder, not a pipeline element, so every consumer writes the same bridging task. `src/elements/rtp/rtsp.rs:278` — `RtspSrc` holds config; `:362` `connect()` returns an `RtspSession` (`:391`). `RtspSession` does **not** implement `Element` — you pull from it with `next_frame()` and feed the result into an `AppSrc` by hand (see `examples/58_rtsp_display.rs:83-107`). Every other source (`V4l2Src`, `VideoTestSrc`, ...) is a graph node you `add_source()` and link. RTSP is the odd one out, and the boilerplate — spawn a task, loop `next_frame()`, push into an `AppSrc`, handle EOS and reconnect — is identical for everyone who does it. ## Ask An `Element` source wrapping the session, so RTSP is `add_source("rtsp", RtspSrc::new(url).connect()?)` like everything else. Keep the manual `RtspSession` path for callers who want to own the pump. Lowest priority of the batch — it's boilerplate, not a blocker. Filing it for completeness while the upstream asks are being collected.
p13marc commented 2026-07-14 15:52:52 +00:00 (Migrated from github.com)

Update: breaking changes are on the table, so this can be the real fix rather than an additive convenience.

Make RtspSrc an Element, changing/retiring the RtspSession pull API rather than preserving it alongside. Every other source in the crate is a graph node you add_source() and link(); RTSP being a config-builder-plus-manual-pump is an inconsistency, not a feature, and every consumer pays the same boilerplate (spawn a task, loop next_frame(), push into an AppSrc, handle EOS and reconnect).

Still the lowest-priority item in this batch — but if a breaking release is being cut anyway, this is the moment to take it, because doing it later costs a second break.

**Update: breaking changes are on the table**, so this can be the real fix rather than an additive convenience. Make `RtspSrc` an `Element`, changing/retiring the `RtspSession` pull API rather than preserving it alongside. Every other source in the crate is a graph node you `add_source()` and `link()`; RTSP being a config-builder-plus-manual-pump is an inconsistency, not a feature, and every consumer pays the same boilerplate (spawn a task, loop `next_frame()`, push into an `AppSrc`, handle EOS and reconnect). Still the lowest-priority item in this batch — but if a breaking release is being cut anyway, this is the moment to take it, because doing it later costs a second break.
Sign in to join this conversation.
No description provided.