rtp-tools: add rtp header

This commit is contained in:
Preston Baxter 2024-09-22 18:17:05 -05:00
parent f1fe0be15b
commit 325538e3cc
2 changed files with 12 additions and 2 deletions

View File

@ -6,3 +6,4 @@ edition = "2021"
[dependencies] [dependencies]
anyhow = "1.0.87" anyhow = "1.0.87"
clap = { version = "4.5.17", features = ["derive"] } clap = { version = "4.5.17", features = ["derive"] }
rtp-rs = "0.6.0"

View File

@ -3,6 +3,7 @@ use std::{cmp::min, fs::File, io::Read, vec::Vec, time::Duration};
use anyhow::Result; use anyhow::Result;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use rtp_rs::*;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[command(version, about, long_about = None)] #[command(version, about, long_about = None)]
@ -80,10 +81,18 @@ fn main() -> Result<()> {
let pacing = pacing(48000, 16, header_len); let pacing = pacing(48000, 16, header_len);
let mut i = 1; let mut i = 1;
for packet in packets { for packet in packets {
std::thread::sleep(pacing);
print!("Playing chunk {i} of {packet_len}\r"); 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; i += 1;
std::thread::sleep(pacing);
} }
println!("\nFinished playing all the things."); println!("\nFinished playing all the things.");