Top | ![]() |
![]() |
![]() |
![]() |
rtpjitterbufferrtpjitterbuffer — A buffer that deals with network jitter and other transmission faults |
gboolean | do-lost | Read / Write |
gboolean | drop-on-latency | Read / Write |
guint | latency | Read / Write |
gint64 | ts-offset | Read / Write |
RTPJitterBufferMode | mode | Read / Write |
gint | percent | Read |
gboolean | do-retransmission | Read / Write |
gint | rtx-delay | Read / Write |
gint | rtx-delay-reorder | Read / Write |
gint | rtx-retry-period | Read / Write |
gint | rtx-retry-timeout | Read / Write |
void | clear-pt-map | Action |
void | handle-sync | Run Last |
void | on-npt-stop | Run Last |
GstCaps* | request-pt-map | Run Last |
guint64 | set-active | Action |
This element reorders and removes duplicate RTP packets as they are received from a network source.
The element needs the clock-rate of the RTP payload in order to estimate the delay. This information is obtained either from the caps on the sink pad or, when no caps are present, from the “request-pt-map” signal. To clear the previous pt-map use the “clear-pt-map” signal.
The rtpjitterbuffer will wait for missing packets up to a configurable time limit using the “latency” property. Packets arriving too late are considered to be lost packets. If the “do-lost” property is set, lost packets will result in a custom serialized downstream event of name GstRTPPacketLost. The lost packet events are usually used by a depayloader or other element to create concealment data or some other logic to gracefully handle the missing packets.
The jitterbuffer will use the DTS (or PTS if no DTS is set) of the incomming buffer and the rtptime inside the RTP packet to create a PTS on the outgoing buffer.
The jitterbuffer can also be configured to send early retransmission events upstream by setting the “do-retransmission” property. In this mode, the jitterbuffer tries to estimate when a packet should arrive and sends a custom upstream event named GstRTPRetransmissionRequest when the packet is considered late. The initial expected packet arrival time is calculated as follows:
If seqnum N arrived at time T, seqnum N+1 is expected to arrive at T + packet-spacing + “rtx-delay”. The packet spacing is calculated from the DTS (or PTS is no DTS) of two consecutive RTP packets with different rtptime.
If seqnum N0 arrived at time T0 and seqnum Nm arrived at time Tm, seqnum Ni is expected at time Ti = T0 + i*(Tm - T0)/(Nm - N0). Any previously scheduled timeout is overwritten.
If seqnum N arrived, all seqnum older than N - “rtx-delay-reorder” are considered late immediately. This is to request fast feedback for abonormally reorder packets before any of the previous timeouts is triggered.
A late packet triggers the GstRTPRetransmissionRequest custom upstream event. After the initial timeout expires and the retransmission event is sent, the timeout is scheduled for T + “rtx-retry-timeout”. If the missing packet did not arrive after “rtx-retry-timeout”, a new GstRTPRetransmissionRequest is sent upstream and the timeout is rescheduled again for T + “rtx-retry-timeout”. This repeats until “rtx-retry-period” elapsed, at which point no further retransmission requests are sent and the regular logic is performed to schedule a lost packet as discussed above.
This element acts as a live element and so adds “latency” to the pipeline.
This element will automatically be used inside rtpbin.
1 |
gst-launch-1.0 rtspsrc location=rtsp://192.168.1.133:8554/mpeg1or2AudioVideoTest ! rtpjitterbuffer ! rtpmpvdepay ! mpeg2dec ! xvimagesink |
Last reviewed on 2007-05-28 (0.10.5)
plugin |
rtpmanager |
author |
Philippe Kalaf <philippe.kalaf@collabora.co.uk>, Wim Taymans <wim.taymans@gmail.com> |
class |
Filter/Network/RTP |
“do-lost”
property“do-lost” gboolean
Send an event downstream when a packet is lost.
Flags: Read / Write
Default value: FALSE
“drop-on-latency”
property“drop-on-latency” gboolean
Tells the jitterbuffer to never exceed the given latency in size.
Flags: Read / Write
Default value: FALSE
“latency”
property“latency” guint
Amount of ms to buffer.
Flags: Read / Write
Default value: 200
“ts-offset”
property “ts-offset” gint64
Adjust buffer timestamps with offset in nanoseconds.
Flags: Read / Write
Default value: 0
“mode”
property “mode” RTPJitterBufferMode
Control the buffering algorithm in use.
Flags: Read / Write
Default value: Slave receiver to sender clock
“percent”
property“percent” gint
The buffer filled percent.
Flags: Read
Allowed values: [0,100]
Default value: 0
“do-retransmission”
property“do-retransmission” gboolean
Send retransmission events upstream when a packet is late.
Flags: Read / Write
Default value: FALSE
“rtx-delay”
property“rtx-delay” gint
Extra time in ms to wait before sending retransmission event (-1 automatic).
Flags: Read / Write
Allowed values: >= G_MAXULONG
Default value: 20
“rtx-delay-reorder”
property“rtx-delay-reorder” gint
Sending retransmission event when this much reordering (-1 automatic).
Flags: Read / Write
Allowed values: >= G_MAXULONG
Default value: 3
“rtx-retry-period”
property“rtx-retry-period” gint
Try to get a retransmission for this many ms (-1 automatic).
Flags: Read / Write
Allowed values: >= G_MAXULONG
Default value: 160
“rtx-retry-timeout”
property“rtx-retry-timeout” gint
Retry sending a transmission event after this timeout in ms (-1 automatic).
Flags: Read / Write
Allowed values: >= G_MAXULONG
Default value: 40
“clear-pt-map”
signalvoid user_function (GstRtpJitterBuffer *buffer, gpointer user_data)
Invalidate the clock-rate as obtained with the “request-pt-map” signal.
buffer |
the object which received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
“handle-sync”
signalvoid user_function (GstRtpJitterBuffer *buffer, GstStructure *struct, gpointer user_data)
Be notified of new sync values.
buffer |
the object which received the signal |
|
struct |
a GstStructure containing sync values. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“on-npt-stop”
signalvoid user_function (GstRtpJitterBuffer *buffer, gpointer user_data)
Signal that the jitterbufer has pushed the RTP packet that corresponds to the npt-stop position.
buffer |
the object which received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“request-pt-map”
signalGstCaps* user_function (GstRtpJitterBuffer *buffer, guint pt, gpointer user_data)
Request the payload type as GstCaps for pt
.
buffer |
the object which received the signal |
|
pt |
the pt |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“set-active”
signalguint64 user_function (GstRtpJitterBuffer *buffer, gboolean Returns, guint64 arg2, gpointer user_data)
Start pushing out packets with the given base time. This signal is only useful in buffering mode.
buffer |
the object which received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since 0.10.19