Media samples and container I/O.
The bridge between encoded media and RTP: a codec-agnostic [Sample] type, and readers
and writers for the container formats the examples and tests use.
Structure
- [
Sample] — one encoded unit of media (a video frame, an audio frame) with its duration, timestamp and packet metadata. Hand these to a sample-based local track and the RTP packetizer does the rest. - [
io] — theWritertrait plus concrete readers and writers for IVF (VP8/VP9), Ogg (Opus) and H.264/H.265 Annex B —IVFReader,OggReaderand friends — enough to play media from disk or record it to disk.SampleBuildergoes the other way, reassembling inbound RTP into [Sample]s. - [
audio], [video] — per-codec helpers, including audio buffering and frame inspection.
Example
use Bytes;
use Sample;
use SystemInstant;
use Duration;
// One encoded frame, ready to hand to a sample-based local track.
let sample = Sample ;
assert_eq!;
Most applications do not depend on this crate directly — the
rtc crate re-exports it as rtc::media.