pub struct TestMediaTask {
pub peer_id: PeerId,
pub codec_config: MediaCodecConfig,
pub stream: Arc<Mutex<Option<MediaStream>>>,
pub delay: Duration,
/* private fields */
}
Fields§
§peer_id: PeerId
The PeerId that was used to make this Task
codec_config: MediaCodecConfig
The configuration used to make this task
stream: Arc<Mutex<Option<MediaStream>>>
If still started, this holds the MediaStream.
delay: Duration
Delay the task was started with.
Implementations§
Source§impl TestMediaTask
impl TestMediaTask
pub fn new( peer_id: PeerId, codec_config: MediaCodecConfig, stream: MediaStream, delay: Duration, ) -> Self
Sourcepub fn is_started(&self) -> bool
pub fn is_started(&self) -> bool
Return true if the background media task is running.
Sourcepub fn end_prematurely(&self, task_result: Option<Result<(), MediaTaskError>>)
pub fn end_prematurely(&self, task_result: Option<Result<(), MediaTaskError>>)
End the streaming task without an external stop(). Sends an optional result from the task.
Trait Implementations§
Source§impl Clone for TestMediaTask
impl Clone for TestMediaTask
Source§fn clone(&self) -> TestMediaTask
fn clone(&self) -> TestMediaTask
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TestMediaTask
impl Debug for TestMediaTask
Source§impl MediaTask for TestMediaTask
impl MediaTask for TestMediaTask
Source§fn finished(&mut self) -> BoxFuture<'static, Result<(), MediaTaskError>>
fn finished(&mut self) -> BoxFuture<'static, Result<(), MediaTaskError>>
Returns a Future that finishes when the running media task finshes for any reason.
Should return a future that immediately resolves if this task is finished.
Source§fn stop(&mut self) -> Result<(), MediaTaskError>
fn stop(&mut self) -> Result<(), MediaTaskError>
Stops the task normally, signalling to all waiters Ok(()).
Returns the result sent to MediaTask::finished futures, which may be different from Ok(()).
When this function returns, is is good practice to ensure the MediaStream that started
this task is also dropped.
Auto Trait Implementations§
impl Freeze for TestMediaTask
impl !RefUnwindSafe for TestMediaTask
impl Send for TestMediaTask
impl Sync for TestMediaTask
impl Unpin for TestMediaTask
impl !UnwindSafe for TestMediaTask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)