Commit graph

925 commits

Author SHA1 Message Date
Sebastian Dröge
3bc53f0840 rtprtxsend: Fix unitialized variable compiler warning
variable 'rtx_ssrc' is used uninitialized whenever
'if' condition is false [-Werror,-Wsometimes-uninitialized]
2014-02-08 17:24:06 +01:00
Wim Taymans
204bd715d2 rtpjitterbuffer: handle expected packet being an RTX packet
If the expected packet (do_next_seqnum is TRUE) is the one we requested
for retranmission earlier, do the logic to update the retransmission
statistics as well before setting up the timers for the next expected
packet.
Also reset the retransmission counter if the timer is reused for another
seqnum.
2014-01-21 17:52:44 +01:00
Wim Taymans
ddb0b9c422 rtpbin: add a caps accumulator for the request-pt-map signal
Add an accumulator that stops the signal emission as soon as a caps has
been retrieved. Otherwise the default handler would continue emitting
the signal and possibly overwrite the result with NULL again.
2014-01-21 15:48:20 +01:00
Wim Taymans
ef20dfe031 rtxreceive: copy flags and timestamps from original buffer 2014-01-21 15:29:27 +01:00
Wim Taymans
9a3d4d7cbe rtpjitterbuffer: ignore invalid timestamps in rtt calculation
When the input buffer does not have a valid timestamp, don't try to
calculate the round-trip-time.
2014-01-21 15:29:26 +01:00
George Kiagiadakis
1a300eb509 rtprtxsend: ensure that no rtx buffers are sent after EOS
To do that, enqueue the EOS event to be sent from the srcpad task
thread and flush the queue right afterwards, so that no more rtx
buffers can be sent, even if there are more requests coming in.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=722370
2014-01-21 15:00:37 +01:00
George Kiagiadakis
133913a11a rtprtxsend: run a new GstTask on the src pad
The reason behind this is to minimize the retransmission delay.
Previously, when a NACK was received, rtprtxsend would put a
retransmission packet in a queue and it would send it from chain(),
i.e. only after a new buffer would arrive.

This unfortunately was causing big delays, in the order of 60-100 ms,
which can be critical for the receiver side.

By having a separate GstTask for pushing buffers out of rtxsend,
we can push buffers out right after receiving the event, without
waiting for chain() to get called.
2014-01-21 14:54:01 +01:00
Aleix Conchillo Flaqué
cdbb2ba6b8 rtpjitterbuffer: do not drop serialized events when latency is set
Serialized events are now queued in the jitter buffer, so we don't
want to drop them even latency is set.

https://bugzilla.gnome.org/show_bug.cgi?id=722372
2014-01-18 10:38:46 +01:00
George Kiagiadakis
397c4ed7a0 rtprtxsend: remove wrong check for payload type not having been set
1) pt can be lower than 96
2) there is no point in checking that because rtprtxsend will not
   even store buffers for payload types that it doesn't know about,
   so this case will never be reached
2014-01-15 10:13:12 +01:00
George Kiagiadakis
55746eaa4c rtprtxsend: fix data locking when creating rtx packets
This patch moves the creation of rtx packets to be done early,
in the src_event() function, when they are requested. The purpose
is to run gst_rtp_rtx_buffer_new() with the object locked to
protect internal data, because if it is done at the pushing stage,
we would have to lock and unlock multiple times in a row while we
are pushing the rtx buffers.

Previously there was no locking at all, which was terribly wrong.
2014-01-15 10:13:11 +01:00
George Kiagiadakis
3d9ca102c9 rtprtxsend: lock access to internal data in sink_event() function 2014-01-15 10:13:11 +01:00
George Kiagiadakis
ee8ae3000e rtprtxsend: remove unnecessary call to reset() from finalize()
...and use _free_full() on the pending buffers queue now that
reset() is not being called
2014-01-15 10:13:11 +01:00
George Kiagiadakis
f9f7e6e721 rtprtxsend: remove unused parameter from the internal reset() method 2014-01-15 10:13:11 +01:00
George Kiagiadakis
6d588ad6bb rtprtxsend: Use g_slice_* for allocating internal structures 2014-01-15 10:13:11 +01:00
George Kiagiadakis
75859ae924 rtprtxreceive: remove stupid mutex unlock in the middle of chain() 2014-01-15 10:13:11 +01:00
George Kiagiadakis
bf347dc50c rtprtxreceive: use GST_DEBUG_OBJECT / GST_WARNING_OBJECT instead of GST_DEBUG / g_warning 2014-01-15 10:13:11 +01:00
George Kiagiadakis
47788929d3 rtprtxreceive: fix integer format specifiers in GST_DEBUG
seqnum in this function is 32-bit, so G_GUINT16_FORMAT would
produce undefined output on big endian systems
2014-01-15 10:13:11 +01:00
George Kiagiadakis
252dfc34c8 rtprtxsend: change the rtx_pt_map directly in set_property() instead of delaying it for chain()
The same lock is held, so there is no point in complicating it...
2014-01-15 10:13:11 +01:00
George Kiagiadakis
8a0ae00ea8 rtprtxreceive: change the rtx_pt_map directly in set_property() instead of delaying it for chain()
The same lock is held, so there is no point in complicating it...
2014-01-15 10:13:11 +01:00
George Kiagiadakis
513ffc45b5 rtprtxreceive: simplify the code of finalize() 2014-01-15 10:13:11 +01:00
George Kiagiadakis
0fdae5f2f7 rtprtxreceive: use the GstObject lock instead of a new one 2014-01-15 10:13:11 +01:00
George Kiagiadakis
c945200ff2 rtprtxsend: use the GstObject lock instead of a new one 2014-01-15 10:13:11 +01:00
Tim-Philipp Müller
335b619cd5 rtprtxsend: remove duplicate assignment
Coverity CID 1151680
2014-01-09 23:55:16 +00:00
Aleix Conchillo Flaqué
441f286e28 rtpbin: remove unused list of decoders
remove list of decoders, which are already handled by the list of elements.

https://bugzilla.gnome.org/show_bug.cgi?id=719938
2014-01-08 10:23:52 +01:00
George Kiagiadakis
9226091235 rtprtxreceive: modify to use a payload-type map like rtprtxsend 2014-01-03 20:48:29 +01:00
George Kiagiadakis
c8a04bc7b2 rtprtxsend: do not keep history of packets with an unknown payload type
This allows to disable retransmission per payload type by not putting
a certain payload type in the map.
2014-01-03 20:48:29 +01:00
Wim Taymans
130ad1b1fa rtprtxsend: Allow SSRC-multiplexing and multiple payload types in the original stream
Conflicts:
	tests/examples/rtp/server-rtpaux.c
2014-01-03 20:48:29 +01:00
George Kiagiadakis
41285697ac rtprtxsend: Add an rtx-ssrc property to allow external control of the ssrc
This is useful when one needs to know the SSRC beforehands, so that it can
be used for SRTP for example.
2014-01-03 20:48:29 +01:00
Wim Taymans
679b5a8682 session: also push EOS event to RTCP srcpad 2014-01-03 20:48:29 +01:00
Wim Taymans
03e4a180da session: place SSRC in Retransmission event 2014-01-03 20:48:29 +01:00
George Kiagiadakis
0a8b149e9e rtprtxsend: use a realistic limit for the value of max-size-packets
G_MAXINT16 is chosen because if the queue contains more than
G_MAXINT16 packets, seqnum comparison will not work properly.
2014-01-03 20:48:28 +01:00
George Kiagiadakis
51edc07127 rtprtxsend: use a GSequence to implement the buffer queue
This has the advantage that searching the queue to find the
buffer with the requested seqnum is done with binary search.
2014-01-03 20:48:28 +01:00
George Kiagiadakis
487fa8c989 rtprtxsend: retransmit packets in the same order as the rtx requests 2014-01-03 20:48:28 +01:00
George Kiagiadakis
7d530ab59f rtprtxsend: Handle the max_size_time property
This property allows you to specify the amount of buffers
to keep in the retransmission queue expressed as time (ms)
instead of buffer count (which is the max_size_buffers property).
2014-01-03 20:48:28 +01:00
George Kiagiadakis
920a55532c rtprtxsend: keep important buffer information in a private structure
This is to avoid mapping a buffer every time we need to read a seqnum
or a timestamp.
2014-01-03 20:48:28 +01:00
Julien Isorce
5a1aa75961 rtpmanager: add new rtprtxsend / rtprtxreceive elements
The purpose of the sender RTX object is to keep a history
of RTP packets up to a configurable limit (in time). It will
listen for custom retransmission events from downstream. When
it receives a request for retransmission, it will look up the
requested seqnum in its list of stored packets. If the packet
is available, it will create a RTX packet according to RFC 4588
and send this as an auxiliary stream.

The receiver will listen to the custom retransmission events
from the downstream jitterbuffer and will remember the SSRC1
of the stream and seqnum that was requested. When it sees a
packet with one of the stored seqnum, it associates the SSRC2
of the stream with the SSRC1 of the master stream. From then
on it knows that SSRC2 is the retransmission stream of SSRC1.
This algorithm is stated in RFC 4588. For this algorithm to
work, RFC4588 also states that no two pending retransmission
requests can exist for the same seqnum and different SSRCs or
else it would be impossible to associate the retransmission with
the original requester SSRC.
When the RTX receiver has associated the retransmission packets,
it can depayload and forward them to the source pad of the element.

RTX is SSRC-multiplexed

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=711084
2014-01-03 20:47:59 +01:00
Wim Taymans
bb2d37b11d rtpbin: add some docs about AUX elements 2013-12-31 15:08:49 +01:00
Wim Taymans
d08e05b4ef rtpbin: add support for AUX sender and receiver
AUX elements are elements that can be inserted into the rtpbin
pipeline right before or after 1 or more session elements.

The AUX elements are essential for implementing functionality such
as error correction (FEC) and retransmission (RTX).

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=711087
2013-12-31 15:08:48 +01:00
Wim Taymans
ae22c95881 rtpbin: make request_element method internally
We can use the same method to create encoder and decoder elements, they
are just internal elements that we create.
2013-12-31 15:08:48 +01:00
Wim Taymans
ee7f41ba2e rtpsession: internal-ssrc is no longer deprecated 2013-12-30 17:00:45 +01:00
Wim Taymans
e721d26c68 rtpbin: add Since tags 2013-12-30 16:59:20 +01:00
Wim Taymans
5a2bc1405e rtpbin: add signal for new jitterbuffer
Emit a signal when a new jitterbuffer is created so that the app can
have a chance to configure it.
2013-12-30 16:52:28 +01:00
Wim Taymans
3f3b2d0886 rtpbin: handle multiple encoder instances
Keep track of elements that are added to multiple sessions and make sure
we only add them to the rtpbin once and that we clean them when no
session refers to them anymore.
2013-12-30 16:28:57 +01:00
Wim Taymans
05c8edc174 rtpbin: fix memory leaks 2013-12-30 15:17:05 +01:00
Wim Taymans
9345c2280a rtpbin: expect the pads on the encoders
Don't use request pads for the encoder elements, the signal handler
should request the pads and make sure they are available with the right
name.
2013-12-30 15:17:05 +01:00
Wim Taymans
cbc80d10dd rtpbin: request-rtp-encoder are no action signals
The request-rtp-encoder signals are not action signals so mark them
correctly and use an accumulator to collect the result value.
2013-12-30 15:17:05 +01:00
George Kiagiadakis
5ddf6a5e32 gstrtpsession: suggest upstream to use the new "internal-ssrc" after a collision
When a collision is found on the internal ssrc, we have to change it.
Ideally, we want also the payloader upstream to follow this change and use
the new internal ssrc. Ideally we want this condition to be always met:
if there is one payloader sending on this session, its ssrc should match the
internal ssrc.
2013-12-30 14:03:05 +01:00
George Kiagiadakis
17517ca491 rtpsession: allow setting internal-ssrc again 2013-12-30 14:03:05 +01:00
Aleix Conchillo Flaqué
47c65fc269 rtpbin: allow dynamic RTP/RTCP encoders/decoders
* gst/rtpmanager/gstrtpbin.[ch]: four new action signals have been
  added (request-rtp-encoder, request-rtp-decoder, request-rtcp-encoder
  and request-rtcp-decoder). The user will be able to provide encoders
  or decoders dynamically. The encoders must follow the srtpenc API and
  the decoders the srtpdec API. Having separate signals for RTP and RTCP
  allows the user to use different encoders/decoders or provide the same
  one (e.g. that would be the case for srtpenc).

  Also, rtpbin now allows application/x-srtp in its pads.

  https://bugzilla.gnome.org/show_bug.cgi?id=719938
2013-12-30 11:24:00 +01:00
Wim Taymans
f48bbabafc rtpjitterbuffer: dynamically recalculate RTX parameters
Use the round-trip-time and average jitter to dynamically calculate the
retransmission interval and expected packet arrival time.

Based on patches from Torrie Fischer <torrie.fischer@collabora.co.uk>

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=711412
2013-12-30 11:18:51 +01:00