bt_a2dp::media_task

Trait MediaTaskRunner

Source
pub trait MediaTaskRunner: Send {
    // Required method
    fn start(
        &mut self,
        stream: MediaStream,
        offload: Option<AudioOffloadExtProxy>,
    ) -> Result<Box<dyn MediaTask>, MediaTaskError>;

    // Provided methods
    fn reconfigure(
        &mut self,
        _config: &MediaCodecConfig,
    ) -> Result<(), MediaTaskError> { ... }
    fn set_delay(&mut self, _delay: Duration) -> Result<(), MediaTaskError> { ... }
    fn iattach(
        &mut self,
        _parent: &Node,
        _name: &str,
    ) -> Result<(), AttachError> { ... }
}
Expand description

MediaTaskRunners represent an ability of the media system to start streaming media. They are configured for a specific codec by MediaTaskBuilder::configure Typically a MediaTaskRunner can start multiple streams without needing to be reconfigured, although possibly not simultaneously.

Required Methods§

Source

fn start( &mut self, stream: MediaStream, offload: Option<AudioOffloadExtProxy>, ) -> Result<Box<dyn MediaTask>, MediaTaskError>

Start a MediaTask using the MediaStream given. If the task started, returns a MediaTask which will finish if the stream ends or an error occurs, and can be stopped using MediaTask::stop or by dropping the MediaTask. This can fail with MediaTaskError::ResourcesInUse if a MediaTask cannot be started because one is already running.

Provided Methods§

Source

fn reconfigure( &mut self, _config: &MediaCodecConfig, ) -> Result<(), MediaTaskError>

Try to reconfigure the MediaTask to accept a new configuration. This differs from MediaTaskBuilder::configure as it attempts to preserve the same configured session. The runner remains configured with the initial configuration on an error.

Source

fn set_delay(&mut self, _delay: Duration) -> Result<(), MediaTaskError>

Set the delay reported from the peer for this media task. This should configure the media source or sink to attempt to compensate. Typically this is zero for Sink tasks, but Source tasks can receive this info from the peer. May only be supported before start. If an Error is returned, the delay has not been set.

Source

fn iattach(&mut self, _parent: &Node, _name: &str) -> Result<(), AttachError>

Add information from the running media task to the inspect tree (i.e. data transferred, jitter, etc)

Implementors§