pub trait Transcoder: Send {
// Required method
fn on_fragment(&mut self, fragment: &Fragment);
// Provided methods
fn on_start(&mut self, _ctx: &TranscoderContext) { ... }
fn on_stop(&mut self) { ... }
}Expand description
In-process consumer of source Fragment values for one
(broadcast, track, rendition) tuple. The 104 A trait is
observe-only; 105 B extends the concrete implementations with
an output-publish side without changing the trait surface.
Lifecycle is identical to [lvqr_agent::Agent]:
Transcoder::on_startruns exactly once before the firstTranscoder::on_fragment.Transcoder::on_fragmentfires for every source fragment.Transcoder::on_stopruns exactly once after the sourcelvqr_fragment::BroadcasterStreamcloses (every producer clone dropped).
All three calls are wrapped in
std::panic::catch_unwind(AssertUnwindSafe(..)) by the
crate::TranscodeRunner; see the crate-level docs.
The trait is sync. Transcoders that want async or blocking
work (every real gstreamer pipeline) spawn from inside
Transcoder::on_start with a bounded channel to a worker
thread / task – typical pattern for the 105 B
SoftwareTranscoder.
Required Methods§
Sourcefn on_fragment(&mut self, fragment: &Fragment)
fn on_fragment(&mut self, fragment: &Fragment)
Process one source fragment.
Synchronous. Heavy work MUST be offloaded to a worker
thread spawned in on_start; blocking here back-pressures
the per-broadcast drain task with
lvqr_fragment::FragmentBroadcaster’s documented
RecvError::Lagged skip semantics.
Provided Methods§
Sourcefn on_start(&mut self, _ctx: &TranscoderContext)
fn on_start(&mut self, _ctx: &TranscoderContext)
One-shot setup. Called exactly once before the first
Transcoder::on_fragment. Default: no-op.
Sourcefn on_stop(&mut self)
fn on_stop(&mut self)
One-shot teardown after the source broadcaster closes. Default: no-op.
on_stop does NOT fire when the
crate::TranscodeRunnerHandle is dropped mid-stride (the
spawned task is aborted). Matches the
[lvqr_agent::AgentRunner] shutdown shape.