use crate::data_structures::AppData;
use crate::producer::ProducerId;
use crate::uuid_based_wrapper_type;
use crate::worker::RequestError;
use async_trait::async_trait;
uuid_based_wrapper_type!(RtpObserverId);
#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct RtpObserverAddProducerOptions {
pub producer_id: ProducerId,
}
impl RtpObserverAddProducerOptions {
pub fn new(producer_id: ProducerId) -> Self {
Self { producer_id }
}
}
#[async_trait(?Send)]
pub trait RtpObserver {
fn id(&self) -> RtpObserverId;
fn paused(&self) -> bool;
fn app_data(&self) -> &AppData;
fn closed(&self) -> bool;
async fn pause(&self) -> Result<(), RequestError>;
async fn resume(&self) -> Result<(), RequestError>;
async fn add_producer(
&self,
rtp_observer_add_producer_options: RtpObserverAddProducerOptions,
) -> Result<(), RequestError>;
async fn remove_producer(&self, producer_id: ProducerId) -> Result<(), RequestError>;
}