-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
access raw RTP packets (headers and all) #58
Comments
webrtc-rs example: let mut buf = [0u8; 1500];
while let Ok((size, _)) = track.read(&mut buf).await {
let mut buffer = gst::Buffer::with_size(size)
.map_err(|err| tracing::error!("{err}"))
.unwrap();
{
let buffer = buffer.get_mut().unwrap();
buffer
.copy_from_slice(0, &buf[..size])
.map_err(|err| tracing::error!("{err}"))
.unwrap();
}
appsrc
.push_buffer(buffer)
.map_err(|err| tracing::error!("{err}"))
.unwrap();
} |
"Package" = "packet", right?
use futures::StreamExt; // for StreamExt::next
while let Some(pkt) = session.next().await {
let pkt = pkt.unwrap();
match pkt {
PacketItem::RtpPacket(p) => {
// see p.timestamp, p.payload, etc.
},
_ => {} // RTCP sender report; additional payload types in the future
}
} |
@scottlamb yes, packet. I want to get slice, raw bytes: let mut buf = [0u8; 1500]; <--- my buffer for rtp packet.
while let Ok((size, _)) = track.read(&mut buf).await { <--- I receive a packet
...
I can not send |
Oh, the full unparsed RTP packet including the headers? That's not currently available; the non-payload parts are trimmed away here: Lines 203 to 204 in 375754a
There's no reason we couldn't keep it around, except that we currently expose the Out of curiosity, is there a particular reason you want to use gstreamer's |
@scottlamb i tried to use gstreamer-rtp to send rtp payload to gst-pipeline but it doesn't work. More convenient to send raw rtp to Gstreamer and webrtc-rs. |
I mean skipping the rtph264depay step, instead feeding output from Retina's But anyway, I'm working on #47 and think with those API changes, it'll be pretty easy to support getting the full raw RTP packets. |
I just pushed the |
@scottlamb thank you very much |
@scottlamb, i managed to get a stable connection. Here is the code I have been playing with: RTSPlay |
Cool! Glad it worked, and thanks for sharing that code. Learning more about GStreamer has been on my todo list. If I get a chance, I might play around with your code and see if I can remove the From what little I've seen, I really like GStreamer's pipeline model. Seems like overkill for Retina by itself, but maybe someday someone will write a larger media framework in pure Rust... |
Hello. How to Get raw Rtp Package? I want to redirect rtp packages to gstreamer rtph264depay.
The text was updated successfully, but these errors were encountered: