Crate rtp_rs

Source
Expand description

Parser and builder for packets formatted per RFC 3550, A Transport Protocol for Real-Time Applications.

Parse a packet

use rtp_rs::*;
// let data = ...acquire UDP packet from the network etc...
if let Ok(rtp) = RtpReader::new(data) {
    println!("Sequence number {:?}", rtp.sequence_number());
    println!("Payload length {:?}", rtp.payload().len());
}

Build a packet

use rtp_rs::*;

let payload = vec![0u8, 2, 5, 4, 6];
let result = RtpPacketBuilder::new()
    .payload_type(111)
    .ssrc(1337)
    .sequence(Seq::from(1234))
    .timestamp(666657)
    .padded(Pad::round_to(4))
    .marked(true)
    .payload(&payload)
    .build();
if let Ok(packet) = result {
    println!("Packet: {:?}", packet);
}

Structs§

  • Controls if and how an RTP packet should have padding appended after the payload
  • A new packet build which collects the data which should be written as RTP packet
  • Wrapper around a byte-slice of RTP data, providing accessor methods for the RTP header fields.
  • 16 bit RTP sequence number value, as obtained from the sequence_number() method of RtpReader.
  • An Iterator which can produce values from the given start value to the given end value, inclusive.

Enums§

Traits§

  • Trait for types that can produce a SeqIter, with an implementation provided for Range<Seq>.