pub struct Application {
pub name: AppName,
pub broadcast_capacity: usize,
pub gop_capacity: usize,
/* private fields */
}Expand description
One registered application (e.g. “live”, “vod”).
Decoupled from stream-center’s sc-config::AppConfig: it takes a plain
broadcast_capacity and an injected Observer instead of reaching for a
metrics singleton.
Fields§
§name: AppNameApplication name (e.g. "live").
broadcast_capacity: usizePer-stream broadcast channel capacity.
gop_capacity: usizeKeyframe-anchored GOP replay buffer size, in frames (0 disables it).
Implementations§
Source§impl Application
impl Application
Sourcepub fn new(
name: AppName,
broadcast_capacity: usize,
gop_capacity: usize,
observer: Arc<dyn Observer>,
) -> Arc<Self> ⓘ
pub fn new( name: AppName, broadcast_capacity: usize, gop_capacity: usize, observer: Arc<dyn Observer>, ) -> Arc<Self> ⓘ
Create an application with the given per-stream capacities and observer.
Sourcepub async fn start_publish(&self, stream_id: StreamId) -> Result<StreamHandle>
pub async fn start_publish(&self, stream_id: StreamId) -> Result<StreamHandle>
Register a new publishing stream. Fails if a stream with the same ID
is already in the Publishing or Transcoding state.
Sourcepub async fn end_publish(&self, stream_id: &StreamId) -> Result<bool>
pub async fn end_publish(&self, stream_id: &StreamId) -> Result<bool>
Mark a stream as ended and remove it from the active registry.
Returns true if the stream was present and removed, false if it
was already gone (idempotent).
Sourcepub fn get_stream(&self, stream_id: &StreamId) -> Option<StreamHandle>
pub fn get_stream(&self, stream_id: &StreamId) -> Option<StreamHandle>
Look up a live stream handle for playback.
Sourcepub fn active_streams(&self) -> Vec<StreamId>
pub fn active_streams(&self) -> Vec<StreamId>
List all active stream IDs.
Sourcepub fn active_handles(&self) -> Vec<StreamHandle>
pub fn active_handles(&self) -> Vec<StreamHandle>
Snapshot of all live stream handles (used by the engine’s idle reaper).
Sourcepub fn subscribe_events(&self) -> Receiver<StreamEvent>
pub fn subscribe_events(&self) -> Receiver<StreamEvent>
Subscribe to stream lifecycle events for this application.
Sourcepub fn stream_count(&self) -> usize
pub fn stream_count(&self) -> usize
Number of streams currently active in this application.