|
1 | 1 | //! Async Media API |
2 | 2 |
|
3 | | -use rtc::shared::error::Result; |
4 | | - |
| 3 | +use crate::media_stream::{TrackLocal, TrackRemote}; |
| 4 | +use rtc::media_stream::MediaStreamId; |
| 5 | +use rtc::rtp_transceiver::rtp_receiver::{RTCRtpContributingSource, RTCRtpSynchronizationSource}; |
| 6 | +use rtc::rtp_transceiver::rtp_sender::{ |
| 7 | + RTCRtpCapabilities, RTCRtpCodec, RTCRtpReceiveParameters, RTCRtpSendParameters, |
| 8 | + RTCSetParameterOptions, RtpCodecKind, |
| 9 | +}; |
5 | 10 | pub use rtc::rtp_transceiver::{ |
6 | 11 | RTCRtpReceiverId, RTCRtpSenderId, RTCRtpTransceiverDirection, RTCRtpTransceiverInit, |
7 | 12 | }; |
| 13 | +use rtc::shared::error::Result; |
| 14 | +use rtc::statistics::StatsSelector; |
| 15 | +use rtc::statistics::report::RTCStatsReport; |
| 16 | +use std::sync::Arc; |
| 17 | +use std::time::Instant; |
8 | 18 |
|
9 | 19 | #[async_trait::async_trait] |
10 | 20 | pub trait RtpReceiver: Send + Sync + 'static { |
11 | | - async fn close(&self) -> Result<()>; |
| 21 | + async fn track(&self) -> Arc<dyn TrackRemote>; |
| 22 | + async fn get_capabilities(&self, kind: RtpCodecKind) -> Option<RTCRtpCapabilities>; |
| 23 | + async fn get_parameters(&mut self) -> RTCRtpReceiveParameters; |
| 24 | + async fn get_contributing_sources(&self) -> Vec<RTCRtpContributingSource>; |
| 25 | + async fn get_synchronization_sources(&self) -> Vec<RTCRtpSynchronizationSource>; |
| 26 | + async fn get_stats(&self, now: Instant, selector: StatsSelector) -> RTCStatsReport; |
12 | 27 | } |
13 | 28 |
|
14 | 29 | #[async_trait::async_trait] |
15 | 30 | pub trait RtpSender: Send + Sync + 'static { |
16 | | - async fn close(&self) -> Result<()>; |
| 31 | + async fn track(&self) -> Arc<dyn TrackLocal>; |
| 32 | + async fn get_capabilities(&self, kind: RtpCodecKind) -> Option<RTCRtpCapabilities>; |
| 33 | + async fn set_parameters( |
| 34 | + &mut self, |
| 35 | + parameters: RTCRtpSendParameters, |
| 36 | + set_parameter_options: Option<RTCSetParameterOptions>, |
| 37 | + ) -> Result<()>; |
| 38 | + async fn get_parameters(&mut self) -> RTCRtpSendParameters; |
| 39 | + async fn replace_track(&mut self, track: Arc<dyn TrackLocal>) -> Result<()>; |
| 40 | + async fn set_streams(&mut self, streams: Vec<MediaStreamId>); |
| 41 | + async fn get_stats(&self, now: Instant, selector: StatsSelector) -> RTCStatsReport; |
17 | 42 | } |
18 | 43 |
|
19 | 44 | #[async_trait::async_trait] |
20 | 45 | pub trait RtpTransceiver: Send + Sync + 'static { |
21 | | - async fn close(&self) -> Result<()>; |
| 46 | + async fn mid(&self) -> Option<String>; |
| 47 | + async fn sender(&self) -> Option<Arc<dyn RtpSender>>; |
| 48 | + async fn receiver(&self) -> Option<Arc<dyn RtpReceiver>>; |
| 49 | + async fn direction(&self) -> RTCRtpTransceiverDirection; |
| 50 | + async fn current_direction(&self) -> RTCRtpTransceiverDirection; |
| 51 | + async fn stop(&self) -> Result<()>; |
| 52 | + async fn set_codec_preferences(&self, codecs: Vec<RTCRtpCodec>) -> Result<()>; |
22 | 53 | } |
0 commit comments