Skip to main content

MediaSession

Struct MediaSession 

Source
pub struct MediaSession { /* private fields */ }
Expand description

A complete RTP media session with bidirectional audio.

Manages:

  • Audio capture from microphone
  • Encoding with the configured codec
  • RTP packet transmission
  • RTP packet reception
  • Decoding and playback to speaker
  • RTCP statistics reporting

Implementations§

Source§

impl MediaSession

Source

pub async fn start( local_rtp_port: u16, remote_addr: SocketAddr, codec_type: CodecType, ) -> Result<Self>

Start a media session with the specified codec.

§Arguments
  • local_rtp_port - Local UDP port for RTP
  • remote_addr - Remote RTP endpoint address
  • codec_type - Audio codec to use
Source

pub async fn start_with_srtp( local_rtp_port: u16, remote_addr: SocketAddr, codec_type: CodecType, srtp_ctx: SrtpContext, ) -> Result<Self>

Start a media session with SRTP encryption.

Source

pub fn send_dtmf(&self, digit: &str)

Send an RFC 2833 DTMF digit.

Source

pub fn set_mute(&self, mute: bool)

Set mute state.

Source

pub fn is_muted(&self) -> bool

Check if muted.

Source

pub fn stats(&self) -> RtpStats

Get current statistics.

Source

pub fn codec(&self) -> CodecType

Get the codec in use.

Source

pub fn ssrc(&self) -> u32

Get the SSRC.

Source

pub fn remote_addr(&self) -> SocketAddr

Get the remote address.

Source

pub fn learned_remote(&self) -> Option<SocketAddr>

Get the learned remote address (for symmetric RTP/comedia).

Source

pub fn stop(&self)

Stop the media session.

Trait Implementations§

Source§

impl Debug for MediaSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for MediaSession

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,