pub trait MediaTaskBuilder:
Send
+ Sync
+ DynClone {
// Required methods
fn configure(
&self,
peer_id: &PeerId,
codec_config: &MediaCodecConfig,
) -> Result<Box<dyn MediaTaskRunner>, MediaTaskError>;
fn direction(&self) -> EndpointType;
fn supported_configs(
&self,
peer_id: &PeerId,
offload: Option<AudioOffloadExtProxy>,
) -> BoxFuture<'static, Result<Vec<MediaCodecConfig>, MediaTaskError>>;
}
Expand description
MediaTaskRunners are configured with information about the media codec when either peer in a conversation configures a stream endpoint. When successfully configured, they can start MediaTasks by accepting a MediaStream, which will provide or consume media on that stream until dropped or stopped.
A builder that will make media task runners from requested configurations.
Required Methods§
Sourcefn configure(
&self,
peer_id: &PeerId,
codec_config: &MediaCodecConfig,
) -> Result<Box<dyn MediaTaskRunner>, MediaTaskError>
fn configure( &self, peer_id: &PeerId, codec_config: &MediaCodecConfig, ) -> Result<Box<dyn MediaTaskRunner>, MediaTaskError>
Configure a new stream based on the given codec_config
parameters.
Returns a MediaTaskRunner if the configuration is supported, an
MediaTaskError::NotSupported otherwise.
Sourcefn direction(&self) -> EndpointType
fn direction(&self) -> EndpointType
Return the direction of tasks created by this builder. Source tasks provide local encoded audio to a peer. Sink tasks consume encoded audio from a peer.
Sourcefn supported_configs(
&self,
peer_id: &PeerId,
offload: Option<AudioOffloadExtProxy>,
) -> BoxFuture<'static, Result<Vec<MediaCodecConfig>, MediaTaskError>>
fn supported_configs( &self, peer_id: &PeerId, offload: Option<AudioOffloadExtProxy>, ) -> BoxFuture<'static, Result<Vec<MediaCodecConfig>, MediaTaskError>>
Provide a set of encoded media configurations that this task can support.
This can vary based on current system capabilities, and should be checked before
communicating capabilities to each peer.
offload
is a proxy to the offload capabilities of the controller for this peer.
Returns a future that resolves to the set of MediaCodecConfigs that this builder supports,
typically one config per MediaCodecType, or an error if building the configs failed.