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§
Sourcefn write_to(&self, buf: &mut [u8], ev: &ExtensionValues) -> usize
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.
Sourcefn parse_value(&self, buf: &[u8], ev: &mut ExtensionValues) -> bool
fn parse_value(&self, buf: &[u8], ev: &mut ExtensionValues) -> bool
Parse a value and put it in the ExtensionValues::user_values
field.
Provided Methods§
Sourcefn requires_two_byte_form(&self, _ev: &ExtensionValues) -> bool
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.