From 325538e3cce7d280d6d4f39c5e17e0816a32d16c Mon Sep 17 00:00:00 2001 From: Preston Baxter Date: Sun, 22 Sep 2024 18:17:05 -0500 Subject: [PATCH] rtp-tools: add rtp header --- tools/rtp-tools/Cargo.toml | 1 + tools/rtp-tools/src/main.rs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/rtp-tools/Cargo.toml b/tools/rtp-tools/Cargo.toml index aaa7855..bcfe547 100644 --- a/tools/rtp-tools/Cargo.toml +++ b/tools/rtp-tools/Cargo.toml @@ -6,3 +6,4 @@ edition = "2021" [dependencies] anyhow = "1.0.87" clap = { version = "4.5.17", features = ["derive"] } +rtp-rs = "0.6.0" diff --git a/tools/rtp-tools/src/main.rs b/tools/rtp-tools/src/main.rs index b792159..82c83ed 100644 --- a/tools/rtp-tools/src/main.rs +++ b/tools/rtp-tools/src/main.rs @@ -3,6 +3,7 @@ use std::{cmp::min, fs::File, io::Read, vec::Vec, time::Duration}; use anyhow::Result; use clap::{Parser, Subcommand}; +use rtp_rs::*; #[derive(Parser, Debug)] #[command(version, about, long_about = None)] @@ -80,10 +81,18 @@ fn main() -> Result<()> { let pacing = pacing(48000, 16, header_len); let mut i = 1; for packet in packets { - std::thread::sleep(pacing); print!("Playing chunk {i} of {packet_len}\r"); - udp_socket.send(&packet)?; + let p = RtpPacketBuilder::new() + .payload_type(111) + .ssrc(1337) + .sequence(Seq::from(i)) + .timestamp(10000+i as u32) + .marked(true) + .payload(&packet) + .build(); + udp_socket.send(&p)?; i += 1; + std::thread::sleep(pacing); } println!("\nFinished playing all the things.");