From 618a348b28ee17794911abe1ef3fa99a35408623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Thu, 10 Jul 2025 19:30:27 +0200 Subject: [PATCH] rtpbin2: add a bit of documentation Part-of: --- net/rtp/src/rtpbin2/rtprecv.rs | 25 +++++++++++++++++++++++++ net/rtp/src/rtpbin2/rtpsend.rs | 22 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/net/rtp/src/rtpbin2/rtprecv.rs b/net/rtp/src/rtpbin2/rtprecv.rs index a4d3db681..bd313c217 100644 --- a/net/rtp/src/rtpbin2/rtprecv.rs +++ b/net/rtp/src/rtpbin2/rtprecv.rs @@ -1,5 +1,30 @@ // SPDX-License-Identifier: MPL-2.0 +/** + * SECTION:element-rtprecv + * @see_also: rtpsend, rtpbin, rtpsession, rtpjitterbuffer. + * + * RTP session management (receiver). + * + * ## Example pipeline + * + * |[ + * gst-launch-1.0 \ + * udpsrc port=5004 caps='application/x-rtp, media=audio, clock-rate=48000, encoding-name=OPUS, encoding-params=(string)1, sprop-stereo=(string)0, payload=96' \ + * ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=200000000 ! recv.rtp_sink_0 \ + * udpsrc port=5005 caps='application/x-rtcp' \ + * ! recv.rtcp_sink_0 \ + * rtprecv name=recv rtp-id=example-rtp-id latency=200 \ + * ! rtpopusdepay2 ! opusdec ! audioconvert ! audioresample ! queue max-size-bytes=0 max-size-buffers=1 max-size-time=0 ! autoaudiosink \ + * rtpsend name=send rtp-id=example-rtp-id \ + * send.rtcp_src_0 ! udpsink port=5007 host=127.0.0.1 async=false + * ]| This will process incoming RTP & RTCP packets from UDP ports 5004 & 5005, + * provided the RTP packets contain an Opus encoded audio stream, and will send + * RTCP back to the sender on UDP port 5007. + * See #rtpsend for an example of how to produce such packets. + * + * Since: plugins-rs-0.13.0 + */ use std::collections::{BTreeMap, HashMap}; use std::net::SocketAddr; use std::ops::ControlFlow; diff --git a/net/rtp/src/rtpbin2/rtpsend.rs b/net/rtp/src/rtpbin2/rtpsend.rs index 8ab5eca34..15dc718f3 100644 --- a/net/rtp/src/rtpbin2/rtpsend.rs +++ b/net/rtp/src/rtpbin2/rtpsend.rs @@ -1,5 +1,27 @@ // SPDX-License-Identifier: MPL-2.0 +/** + * SECTION:element-rtpsend + * @see_also: rtprecv, rtpbin, rtpsession, rtpjitterbuffer. + * + * RTP session management (sender). + * + * ## Example pipeline + * + * |[ + * gst-launch-1.0 \ + * audiotestsrc is-live=true ! opusenc ! rtpopuspay2 ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=100000000 \ + * ! rtpsend name=send rtp-id=example-rtp-id \ + * send.rtp_src_0 ! udpsink port=5004 host=127.0.0.1 \ + * send.rtcp_src_0 ! udpsink port=5005 host=127.0.0.1 async=false \ + * rtprecv name=recv rtp-id=example-rtp-id \ + * udpsrc port=5007 caps='application/x-rtcp' ! recv.rtcp_sink_0 + * ]| This will produce an Opus encoded audio stream and send it as RTP packets with RTCP + * over UDP ports 5004 & 5005. The pipeline expects RTCP to be sent back on UDP port 5007. + * See #rtprecv for an example of how to process such packets. + * + * Since: plugins-rs-0.13.0 + */ use std::collections::HashMap; use std::pin::Pin; use std::sync::{Arc, Mutex};