Trait ExtensionSerializer

Source
pub trait ExtensionSerializer:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn write_to(&self, buf: &mut [u8], ev: &ExtensionValues) -> usize;
    fn parse_value(&self, buf: &[u8], ev: &mut ExtensionValues) -> bool;
    fn is_video(&self) -> bool;
    fn is_audio(&self) -> bool;

    // Provided method
    fn requires_two_byte_form(&self, _ev: &ExtensionValues) -> bool { ... }
}
Expand description

Trait for parsing/writing user RTP header extensions.

Required Methods§

Source

fn write_to(&self, buf: &mut [u8], ev: &ExtensionValues) -> usize

Write the extension to the buffer of bytes. Must return the number of bytes written. This can be 0 if the extension could not be serialized.

Source

fn parse_value(&self, buf: &[u8], ev: &mut ExtensionValues) -> bool

Parse a value and put it in the ExtensionValues::user_values field.

Source

fn is_video(&self) -> bool

Tell if this extension should be used for video media.

Source

fn is_audio(&self) -> bool

Tell if this extension should be used for audio media.

Provided Methods§

Source

fn requires_two_byte_form(&self, _ev: &ExtensionValues) -> bool

When calling write_to, if the size of the written value may exceed 16 bytes, or may be 0 bytes, the two byte header extension form must be used. Otherwise, the one byte form may be used, which is usually the case.

Implementors§