Commit graph

1205 commits

Author SHA1 Message Date
Sebastian Dröge
735c6c40f8 rtpjitterbuffer: When resetting the jitterbuffer because of packet discont, don't flush sticky events
We will otherwise flush away STREAM_START, CAPS or SEGMENT events and will
confuse downstream with buffers that come before such events.
2015-02-17 16:57:55 +02:00
Sebastian Dröge
b79eff7f9b rtpsession: Handle first RTCP packet and early feedback correctly
According to RFC 4585 section 3.5.3 step 1 we are not allowed to send
an early RTCP packet for the very first one. It must be a regular one.

Also make sure to not use last_rtcp_send_time in any calculations until
we actually sent an RTCP packet already. In specific this means that we
must not use it for forward reconsideration of the current RTCP send time.
Instead we don't do any forward reconsideration for the first RTCP packet.
2015-02-11 10:32:46 +01:00
Sebastian Dröge
075eb10e65 rtpsession: Fix signal name
This wasn't meant to be pushed at all yet, but now that it's there
already it won't hurt to make it correct at least.
2015-01-30 18:22:31 +01:00
Sebastian Dröge
ec99bbb5e1 rtpstats: Fix typo in documentation 2015-01-30 16:56:35 +01:00
Sebastian Dröge
77511b156e rtpsession: Add new on-receiving-rtcp signal
This will be emitted whenever an RTCP packet is received. Different to
on-feedback-rtcp, this signal gets every complete RTCP packet and not
just the individual feedback packets.
2015-01-30 16:50:36 +01:00
Sebastian Dröge
e4ed852041 rtpsession: Deprecate rtcp-immediate-feedback-threshold property
It had no effect since quite some time and also is not needed in general,
especially not to switch between immediate feedback mode and early feedback
mode. The latest understanding of the RFC is that from the endpoint point of
view, both modes are exactly the same. RTCP is only allowed to use the
bandwidth as given by the RFC constraints, as such it is only ever possible
to schedule a RTCP packet early but it's against the RFC to schedule more RTCP
packets.

The difference between immediate feedback mode and early feedback mode is that
the former guarantees that an RTCP packet can be sent for every event
"immediately", which means that the bandwidth calculations from the RFC have
resulted in an RTCP scheduling interval that is small enough. Early feedback
mode on the other hand means that we can schedule some packets early to make
that happen, but it's not guaranteed at all that it's possible to schedule
an RTCP packet per event (i.e. they need to be accumulated or dropped).
2015-01-26 18:49:31 +01:00
Sebastian Dröge
b07b7736b3 rtpsession: Delay the next regular RTCP packet after early RTCP
This is required to not exceed the short term average RTCP bitrate when
using early feedback as compared to without early feedback.
2015-01-26 18:49:31 +01:00
Sebastian Dröge
bc9111a03d rtpsession: Add new send-rtcp-full signal
This indicates with a boolean return value if scheduling a new RTCP packet
within the requested delay was possible. Otherwise it behaves exactly like
send-rtcp. The only reason for adding a new signal is ABI compatibility.
2015-01-26 18:49:31 +01:00
Sebastian Dröge
60e2d0c84f rtpsession: Fix indention 2015-01-22 11:03:25 +01:00
Sebastian Dröge
87c8c163a8 rtpjitterbuffer: If we get a gap with a buffer without DTS, error out
We (currently?) can't really handle gaps between RTP packets if they're not
properly timestamped. The current code would go into calculations with
GST_CLOCK_TIME_NONE and then cause assertions everywhere. It's probably
better to error out cleanly instead.
2015-01-07 18:05:18 +01:00
Tim-Philipp Müller
c62209d050 rtpptdemux: just drop invalid rtp packets instead of erroring out
Apparently linphone sends an invalid RTP packet as very
first packet. We want to ignore that instead of erroring
out (same for any other invalid packets really).

https://bugzilla.gnome.org/show_bug.cgi?id=741398
2014-12-25 15:48:04 +00:00
Tim-Philipp Müller
bcad30510b rtpptdemux: fix 0.10-ism in docs 2014-12-25 15:44:15 +00:00
Thibault Saunier
52a1773b40 rtpsession: Use an empty iterator in iterate_internal_link when no links
And not a NULL Iterator, so it is consistent with the way it usually
works and avoid user to need a different code paths to handle that.
2014-12-09 20:38:22 +01:00
Thibault Saunier
aa89278ade rtpjitterbuffer: Use an empty iterator in iterate_internal_link when no links
We used to setup an iterator with 1 GValue set with a NULL object
pointer which is not the normal way to do that. Instead we should make
sure that the first call to gst_iterator_next returns GST_ITERATOR_DONE.
2014-12-03 11:17:11 +01:00
Olivier Crête
ccac1f8c0b rtprtxreceive: Use offset when copying header
The header is not always at the start of the packet, so we need to compute
the offset first.
2014-11-29 18:38:12 -05:00
Miguel París Díaz
6daa57868f rtpjitterbuffer: ensure rtx_retry_period >= 0
https://bugzilla.gnome.org/show_bug.cgi?id=739344
2014-11-22 14:48:57 +00:00
Arun Raghavan
45e716e75d rtpbin: Fix up new_jitterbuffer signal prototype 2014-11-20 22:42:59 +05:30
Arun Raghavan
56436ccced rtpbin: Document how to control per-SSRC retransmission 2014-11-20 20:24:42 +05:30
Arun Raghavan
1c3b233fef rtpmanager: Trivial typo fix 2014-11-10 13:16:50 +05:30
Tim-Philipp Müller
d940c21b78 rtpjitterbuffer: implement get/set for new rtx-min-retry-timeout property
Properties are so much more useful if you can actually set
and get their values.
2014-11-02 13:06:33 +00:00
Tim-Philipp Müller
b02d73a0ed rtpjitterbuffer: fix crash on some 32-bit systems
Make sure to pass right number of bits to gst_structure_new()
which is a vararg function.

Fixes elements/rtpaux unit test on ppc32.
2014-10-25 12:45:31 +01:00
Wim Taymans
bd09dc96e9 rtpjitterbuffer: limit the retry frequency
When the RTT and jitter are very low (such as on a local network), the
calculated retransmission timeout is very small. Set some sensible lower
boundary to the timeout by adding a new property. We use the packet
spacing as a lower boundary by default.
2014-10-22 15:04:24 +02:00
Miguel París Díaz
4b5243c43d gstrtpjitterbuffer: add "rtx-min-delay" property
This property is useful to set a min time to wait before sending a
retransmission event.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=735378
2014-10-22 15:00:27 +02:00
Wim Taymans
0b81b316b5 jitterbuffer: Refactor code
Refactor some code dealing with calculating various timeouts.

See https://bugzilla.gnome.org/show_bug.cgi?id=735378
2014-10-22 14:59:57 +02:00
Miguel París Díaz
e6504e3a65 rtpsession: fix Early Feedback Transmission
In early retransmission we are allowed to schedule 1 regular RTCP packet
at an earlier time. When we do that, we need to set allow_early to FALSE
and ignore/drop (or merge) all future requests for early transmission.
We now first check if we can schedule an early RTCP and if we can,
actually prepare the data for the next RTCP interval.

After we send the next regular RTCP after the early RTCP, we set
allow_early to TRUE again to allow more early requests.

Remove the condition for the immediate feedback for now.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=738319
2014-10-22 13:13:47 +02:00
Wim Taymans
09f179139d rtpjitterbuffer: make debug line less confusing 2014-10-21 13:10:53 +02:00
Wim Taymans
2e7f5c08cf jitterbuffer: rework resync handling
Add a need-resync state, this is when we need to try to lock on to a
time/RTPtime pair.
Always check the RTP timestamps and if they go backwards, mark ourselves
as need-resync.
Only resync when need-resync is TRUE and we have a valid time. Otherwise
we keep the old values. This avoids locking on to an invalid time and
causing us to timestamp everything with -1.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=730417
2014-10-21 11:57:34 +02:00
Sjoerd Simons
0ee384b251 rtpmux: Don't set PROXY_CAPS flag on the src pad
rtpmux behaves like a funnel in that it forwards whatever upstream is
sending buffers. So setting proxy caps doesn't make sense as the
upstream don't have to have compatible caps, thus resulting in an empty
caps set as a result of a caps query. Instead set fixed caps just
as funnel does.

https://bugzilla.gnome.org/show_bug.cgi?id=738722
2014-10-21 10:52:00 +02:00
Olivier Crête
51a8bedced rtpsource: Rename seqnum-base to seqnum-offset in caps
This was modified back in 1.0 in GstRtpBasePayload
2014-10-10 18:33:34 -04:00
Olivier Crête
b3069634bd rtpmux: clock-base and seqnum-base -> timestamp-offset and seqnum-offset
These were renamed in GstRTPBasePayload in 1.0
2014-10-10 18:12:23 -04:00
Stefan Sauer
98222a67ff rtpjitterbuffer: don't log all clock_rate changes as warnings.
We never initialize clock_rate explicitly, therefore it is 0 by default. The
parameter is a uint32 and the only caller ensure that it is >0, therefore it
won't become -1 ever.
2014-10-04 17:17:13 +02:00
Sanjay NM
26a1344f37 Miscellaneous minor cleanups
Fix redundant variables and assignments,
and unreachable breaks.

https://bugzilla.gnome.org/show_bug.cgi?id=736875
https://bugzilla.gnome.org/show_bug.cgi?id=736876
https://bugzilla.gnome.org/show_bug.cgi?id=736879
https://bugzilla.gnome.org/show_bug.cgi?id=736880
https://bugzilla.gnome.org/show_bug.cgi?id=736881
https://bugzilla.gnome.org/show_bug.cgi?id=736888
https://bugzilla.gnome.org/show_bug.cgi?id=736890
https://bugzilla.gnome.org/show_bug.cgi?id=736892
https://bugzilla.gnome.org/show_bug.cgi?id=736893
https://bugzilla.gnome.org/show_bug.cgi?id=736894
2014-09-24 00:45:31 +01:00
Ognyan Tonchev
f7ae4288a2 rtpbin: do not leak encsink pad in error case
https://bugzilla.gnome.org/show_bug.cgi?id=736807
2014-09-18 12:49:53 +03:00
Youness Alaoui
a98341397d jitterbuffer: Allow rtp caps without clock-rate
The jitterbuffer shouldn't force clock-rate on its sink pad, this will cause a negotiation issue since rtpssrcdemux doesn't have the clock-rate and doesn't add it to the caps. The documentation states that the clock-rate can either be specified through the caps or through the request-pt-map signal, so we must remove clock-rate from the pad templates and we must accept the GST_EVENT_CAPS if the caps don't have the clock-rate.

https://bugzilla.gnome.org/show_bug.cgi?id=734322
2014-08-21 18:32:58 -04:00
Sebastian Rasmussen
1a35bf9647 rtpmux: Unref pad template caps after usage
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734473
2014-08-08 15:38:32 -03:00
Sebastian Rasmussen
ca22ad8da9 rtpdtmfmux: Avoid taking an unnecessary ref
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=733122
2014-07-16 16:45:31 +02:00
Sebastian Dröge
2f47105129 rtpbin: Don't leak caps 2014-06-29 23:55:19 +02:00
Sebastian Dröge
bbca040336 rtpssrcdemux: Fix compiler warning when compiling with G_DISABLE_ASSERT 2014-06-29 19:59:53 +02:00
Wim Taymans
ca9cfd40dd jitterbuffer: improve SR packet handling
Implement 3 different cases for handling the SR:

 1) we don't have enough timing information to handle the SR packet and
    we need to wait a little for more RTP packets. In that case we keep
    the SR packet around and retry when we get an RTP packet in the
    chain function.

 2) the SR packet has a too old timestamp and should be discarded. It is
    labeled invalid and the last_sr is cleared.

 3) the SR packet is ok and there is enough timing information, proceed
    with processing the SR packet.

Before this patch, case 2) and 1) were handled in the same way,
resulting that SR packets with too old timestamps were checked over and
over again for each RTP packet.
2014-06-25 16:14:46 +02:00
Miguel París Díaz
b22aed9bbc gstrtpssrcdemux: manage ssrc of RTCP RR packets
https://bugzilla.gnome.org/show_bug.cgi?id=731324
2014-06-23 16:23:00 -04:00
Wim Taymans
d004eda79d rtpsession: update last_activity when sending RTP
Also update last_activity when doing something with the internal
source to make sure don't timeout early.

See https://bugzilla.gnome.org/show_bug.cgi?id=730217
2014-05-16 16:55:17 +02:00
Aleix Conchillo Flaqué
a62b280873 rtpbin: update rtp encoder/decoder docs
Use %u in RTP encoder/decoder pads to match other rtpbin pads.

https://bugzilla.gnome.org/show_bug.cgi?id=730146
2014-05-15 15:48:21 +02:00
George Kiagiadakis
7e2138794f rtpsession: remove unused if branch
1) sources that have sent BYE in the past cannot be senders, since
they would have timed out to being receivers in the meantime...
2) sources that have sent BYE are now being removed earlier inside
this function
2014-05-14 16:01:50 +02:00
George Kiagiadakis
85d4c031d4 rtpsession: cleanup sources that have sent BYE 2014-05-14 16:01:50 +02:00
George Kiagiadakis
7d7840cc4a rtpsession: unify nested if clauses 2014-05-14 16:01:50 +02:00
George Kiagiadakis
0e6a31411b rtpsession: timeout internal sources that are inactive for a long time and send BYE 2014-05-14 16:01:50 +02:00
Aleix Conchillo Flaqué
bcd469ff31 rtpjitterbuffer: don't stop looping if event found in the queue
If we are inserting a packet into the jitter queue we need to keep
looping through the items until the right position is found. Currently,
the code stops as soon as an event is found in the queue.

Regarding events, we should only move packets before an event if there
is another packet before the event that has a larger seqnum.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=730078
2014-05-14 10:23:28 +02:00
Wim Taymans
b2e1598e4a rtpjitterbuffer: increment accepted packets after loss
When we detect a lost packet, expect packets with higher
seqnum on the input.

Also update the unit test.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=729524
2014-05-09 18:10:32 +02:00
Jason Litzinger
9068e1bb8e Add new test case. 2014-05-09 18:10:32 +02:00
Olivier Crête
b2a52035bf rtprtxreceive: Wait until timeout to clear association requests
If two streams request a retranmission for the same SSRC, ignore the second
one if the first oen is less than one second old, otherwise time out the first
one and ignore the second.
2014-05-04 22:36:59 -04:00
Olivier Crête
0742a5a257 rtpmux: Always let upstream chose the ssrc if it wishes 2014-05-04 19:11:03 -04:00
Mark Nauwelaerts
6c584bc833 rtpjitterbuffer: avoid stall by corrupted seqnum accounting 2014-05-04 13:38:26 +02:00
Olivier Crête
2e54d38dd0 rtpsession: Keep local conflicting addresses in the session
As we now replace the local RTPSource on a conflict, it's no longer possible
to keep local conflicts in the RTPSource, so they instead need to be kept
in the RTPSession.

Also fix the rtpcollision test to generate multiple collisions instead of
one by change the address, as otherwise we detected that it was a single one.
2014-05-03 18:30:20 -04:00
Wim Taymans
eba3bba524 rtpjitterbuffer: optimize timer update
When we are not doing retransmission, we just need to find the current
seqnum so we can stop when we found it.
2014-04-29 16:26:53 +02:00
Wim Taymans
b2c9646acb rtpjitterbuffer: small optimizations
Small optimizations where we can.
Add some more debug.
2014-04-29 16:21:44 +02:00
Wim Taymans
df04fcbb5d rtpjitterbuffer: signal when next_seqnum changed
Signal the pushing thread when the next_seqnum changed and we might be
able to push a buffer now.
2014-04-29 16:16:17 +02:00
Wim Taymans
3cd0e8ae88 rtpjitterbuffer: only signal event when head changed
After adding a buffer, only signal the pushing thread when the head
buffer changed or else we cause a useless wakeup.
2014-04-29 16:12:29 +02:00
Wim Taymans
18b69419fd rtpjitterbuffer: rework packet insert
Rework the packet queue so that the most common action (insert a packet
at the tail of the queue) goes very fast.

Report if a packet was inserted at the head instead of the tail so that
we can know when to retry _pop or _peek.
2014-04-29 16:02:37 +02:00
Tim-Philipp Müller
c9597298f9 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 23:35:17 +01:00
Jan Schmidt
f2d0ddf113 rtpjitterbuffer: Clear last_pt on flush-stop.
Otherwise, we don't recheck the buffer caps for clock-rate
properly on the next chain.
2014-04-23 18:54:16 +10:00
Vincent Penquerc'h
f10c3f1a76 rtpmux: fix buffer list drop check
While porting to 0.11, the check was mistakenly made constant,
instead of testing for the return value of process_buffer_locked.

Coverity 1139663
2014-04-21 17:21:20 +01:00
Wim Taymans
3e11ce43b9 jitterbuffer: improve EOS handling
Make a new method to disable the jitterbuffer buffering.
Rework the update_estimated_eos() method. Calculate how much time
there is left to play. If we have less than the delay of the
jitterbuffer, we disabled buffering because we might never be able to
fill the complete jitterbuffer again.
If we receive an EOS event, disable buffering. We will drain the
buffer and eventually push the EOS event out.
When we reach the estimated NPT timeout and we didn't receive an EOS
event, make one and queue it so that it can be pushed.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=728017
2014-04-18 14:07:31 +02:00
Wim Taymans
38a486b374 rtpsession: send reconfigure when internal-ssrc changes
When the internal-ssrc property changes, we want to send a reconfigure
upstream to make payloaders use the new suggested ssrc.
Using the internal-ssrc property to change the SSRC of a stream is not a
good idea and doesn't work when there are multiple senders, we want to
set the SSRC directly on the payloaders. Therefore, deprecate this
property.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=725361
2014-04-18 10:21:27 +02:00
Wim Taymans
42cfedde7f jitterbuffer: assume a full buffer when eos
Rework the logic to make buffering messages a little, make sure we
don't make the same message multiple times.
Consider the buffer full when EOS was received.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=728017
2014-04-18 04:27:39 +02:00
Sebastian Dröge
27cf71e209 rtprtxsend: Require clock-rate in the caps and handle no ssrc in the caps properly 2014-04-17 17:58:58 +02:00
Sebastian Dröge
897c02cace rtpjitterbuffer: Unref clock id when waiting for the clock is interrupted 2014-04-17 17:00:37 +02:00
Wim Taymans
783b4ba2c4 rtpjitterbuffer: refuse serialied query when buffering
When we are buffering, we can't block and wait for the serialized query
to complete because the jitterbuffer will not try to forward the query
while buffering. Instead, just refuse the query.
2014-04-16 18:16:33 +02:00
Wim Taymans
233e9e64b8 rtpjitterbuffer: don't free the serialized query
We should never free a serialized query in the queue, it is the upstream
caller that will free it.
2014-04-16 18:16:32 +02:00
Wim Taymans
c3de599c4f jitterbuffer: demote warning to debug
For TCP, it is normal that we don't have timestamps so don't WARN on
it.
2014-04-03 12:09:24 +02:00
Tim-Philipp Müller
273f389d57 rtpmanager: copy sticky events when exposing pads in more places
https://bugzilla.gnome.org/show_bug.cgi?id=724712
2014-03-29 13:23:02 +00:00
Wim Taymans
3b497bf7d5 rtspsrc: copy sticky events to ghostpad
When we expose internal pads as ghostpads, first copy the sticky events
so that we have the caps and segment etc.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=724712
2014-03-25 11:36:40 +01:00
Wim Taymans
d2f93e3afc session: small cleanups
It's nicer to explicitly check for NULL on pointer types to make it
clear that it's a pointer and not a boolean.
2014-03-05 14:28:26 +01:00
Wim Taymans
5818a0de1a session: handle unknown SSRC in FIR
https://bugzilla.gnome.org/show_bug.cgi?id=725712
2014-03-05 14:27:47 +01:00
Wim Taymans
b4caf09011 jitterbuffer: fix buffer level with invalid DTS
It is possible that the DTS is invalid (when we receive RTP packets from
TCP, for example). As a fallback, use the reconstructed PTS value to
calculate the buffer level.
2014-03-03 11:34:00 +01:00
Tim-Philipp Müller
5bad2d8b70 rtpmanager: re-enable -Werror 2014-02-27 00:12:13 +00:00
Tim-Philipp Müller
1d7f5c7a83 rtpjitterbuffer: fix compiler warning
gstrtpjitterbuffer.c: In function 'gst_rtp_jitter_buffer_loop':
gstrtpjitterbuffer.c:2978:3: error: 'result' may be used uninitialized in this function
   while (result == GST_FLOW_OK);
   ^
2014-02-27 00:11:11 +00:00
Sebastian Dröge
d4bdf5a1b1 rtpjitterbuffer: Fix uninitialized variable compiler warning 2014-02-26 21:11:23 +01:00
Jake Foytik
6dd9142592 rtpjitterbuffer: Remove raw comparisons of RTP sequence numbers
Several conditional statements perform comparison on RTP sequence
numbers without taking the sequence number rollover into account.
Instead, use the gst_rtp_buffer_compare_seqnum function to perform the
comparison.

https://bugzilla.gnome.org/show_bug.cgi?id=725159
2014-02-26 21:11:21 +01:00
Wim Taymans
353e510f94 rtpjitterbuffer: add support for serialized queries
See https://bugzilla.gnome.org/show_bug.cgi?id=723850
2014-02-14 15:59:46 +01:00
Wim Taymans
bbe6d9a258 rtpsession: proxy caps and allocation on RTP pads
recv_rtp_sink: allow proxying of the allocation query.
send_rtp_sink: allow proxying of caps and allocation. This allows us to
query caps downstream as well as get an allocator from downstream.
send_rtp_src: allow proxy of caps, this makes the caps query do
upstream.

See https://bugzilla.gnome.org/show_bug.cgi?id=723850
2014-02-14 12:05:55 +01:00
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
Wim Taymans
416bd9a2c3 rtpjitterbuffer: calculate average jitter 2013-12-30 11:18:51 +01:00
Wim Taymans
7181a21ca9 rtpsession: use RTT from the Retransmission event
Place the estimated RTT in the Retransmission event and let the session
manager use that instead of the hardcoded value.
2013-12-30 11:18:50 +01:00
Wim Taymans
e996f73d0c jitterbuffer: take more accurate running-time for NACK
Don't use the current time calculated from the tmieout loop for when we
last scheduled the NACK because it might be unscheduled because of a max
packet misorder and then we don't accurately calculate the current time.
Instead, take the current element running time using the clock.
2013-12-30 11:18:50 +01:00
Olivier Crête
ada6ea668b rtpsession: Add error message if the app tries to set the internal-ssrc 2013-12-13 17:36:36 -05:00
Olivier Crête
d715010d78 rtpsession: Only count nacks when a nack packet is received
Not when any RTCP feedback packet is.
2013-12-13 16:08:35 -05:00
Olivier Crête
7af9fdbca6 rtpsession: Process PSFB FIR requests which lack the media ssrc
According to RFC 5104 section 4.3.1.2, RTCP PSFB FIR message SHALL
have a media_ssrc field set to 0. The actual media ssrc is in the FCI.
So in that case, we ignore the retained feedback and just let it through
to the rtp_session_process_fir() function which will check for the actual
SSRC inside the FCI.

Fixes a regression introduced by commit 57c27ec3
2013-12-13 16:01:07 -05:00
George Kiagiadakis
6a2de911fa rtpsession: fix rb blocks disappearing after the first rtcp cycle with multiple senders
Previously, when the session had multiple internal sender SSRCs, it would
issue SR reports with RB blocks only on the first RTCP timeout and afterwards
SR reports would be sent empty. This was because the "generation" number
in RTPSource would increase more than once during the same cycle and afterwards
it would always be greater than the session's generation, which would cause
it to be skipped from being included in RBs.

This commit fixes this problem by:
1) Increasing the RTPSource generation only at the end of each cycle,
which essentially fixes the problem but only when the internal senders
are less than GST_RTCP_MAX_RB_COUNT.
2) Keeping for each RTPSource a set of SSRCs which stores which SSRC's
SR the given RTPSource has been reported in, which also fixes the problem
when the internal senders are more than GST_RTCP_MAX_RB_COUNT. This is
necessary because of the fact that any RTPSource is marked as reported
in itself's SR and makes it impossible to know if it has been reported
in other SRs too or not, and which.
2013-12-12 16:44:27 +01:00
George Kiagiadakis
c78a115154 rtpsession: keep extra stats for scheduling BYE
Keep an extra stats structure for scheduling the BYE packets. When we
decide to schedule BYE, make a copy of the current stats into the
bye_stats. Then while we schedule the BYE, update and use only the
bye_stats. When we finished scheduling the BYE packet, we use the
regular stats again.
2013-12-12 10:38:43 +01:00
George Kiagiadakis
282028e753 rtpsession: when we schedule BYE, only deal with BYE sources
When we are doing the RTCP timeout to schedule BYE packets, don't
generate RTCP for all sources but only for the sources marked as BYE.
2013-12-12 10:34:38 +01:00
George Kiagiadakis
6a421c3d81 rtpsession: reset state after scheduling BYE
After we do RTCP, we are not scheduling bye anymore.
2013-12-12 10:32:48 +01:00
George Kiagiadakis
0a0ff100ef rtpsession: also count NACKS when no signal was pending 2013-12-12 10:31:38 +01:00
George Kiagiadakis
bec9c04ea0 session: ignore RTCP packets for the BYE sources
When we are scheduling BYE packets, ignore all RTCP for the sources that
are scheduling a BYE packet. Other sources that are not scheduling BYE
should continue receiving RTCP packets as usual.
2013-12-12 10:09:25 +01:00
Julien Isorce
33b398e345 rtpsession: determine if the session is doing point-to-point
In this case T_dither_max is set to 0 according to RFC 4585
2013-12-10 16:57:56 +01:00
Wim Taymans
eee515cb2c rtpjitterbuffer: serialize events in the buffer
Serialize events into the jitterbuffer by inserting them with a -1
seqnum.
Update unit test to expect events from the streaming thread.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=652986
2013-12-10 11:57:37 +01:00
Wim Taymans
36e78bc5ca rtpjitterbuffer: detect -1 seqnum
Keep the seqnum as a full guint so that we can check for -1 entries and
deal with them correctly.
Immediately try to push -1 seqnum.
2013-12-10 11:04:06 +01:00
Wim Taymans
4a2e0f4ff4 rtpjitterbuffer: reorganize jitterbuffer items
Keep the oldest item at the head and the newest items on the tail. This
makes it easier to deal with -1 seqnums.
2013-12-10 11:01:03 +01:00
Wim Taymans
ea2a222cef jitterbuffer: correctly check for invalid values
Check for -1 on the guint from the buffer item instead of on the guint16
or guint32.
Also insert -1 seqnum at the head of the jitterbuffer.
2013-12-09 23:34:10 +01:00
Wim Taymans
e8edecc56e rtpsession: don't unref buffer twice
Cleaning the packet info will already unref the buffer.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=715078
2013-11-28 16:51:13 +01:00
Wim Taymans
710d1f3a2a rtpjitterbuffer: improve clear-pt-map handling
Don't reset the expected output seqnum when clearing the pt map because this
could stall the jitterbuffer forever.
Add a unit test for this.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=709800
2013-11-25 15:52:22 +01:00
Tim-Philipp Müller
901ec63462 rtpjitterbuffer: fix wake-up when new buffers come in after running empty
Spotted by 'gratias' on IRC. Probably introduced in recent refactoring.

https://bugzilla.gnome.org/show_bug.cgi?id=715039
2013-11-25 00:37:50 +00:00
Wim Taymans
4c9474905b rtpjitterbuffer: pass downstream flowreturn to upstream
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=712722
2013-11-22 12:27:31 +01:00
Wim Taymans
0c6f4efe4a rtpjitterbuffer: avoid mapping the buffer
Reuse the parsed structure to get the timestamps.
2013-11-19 10:12:00 +01:00
Tim-Philipp Müller
d506409af5 docs: get rid of 'Since: 0.10.x' markers
And some gtk-doc markup fixes.
2013-11-18 14:47:35 +00:00
Tim-Philipp Müller
548e756e0a rtpmanager: fix Since markers
Should be next stable release series version
2013-11-16 12:15:14 +00:00
George Kiagiadakis
387e3b918a rtpjitterbuffer: Fix stats property field names and documentation 2013-11-15 16:23:34 +02:00
Torrie Fischer
acf74435e3 gstrtpsession: Implement a number of feedback packet statistics
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=711693
2013-11-15 15:21:19 +01:00
Wim Taymans
b450d31503 rtpjitterbuffer: rename property to 'stats'
This makes the unit test work.
We can later also add more stats, not specific to retransmission.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=711411
2013-11-14 09:24:26 +01:00
Torrie Fischer
22ceb80ba9 rtpjitterbuffer: implement rtx statistics 2013-11-14 09:24:26 +01:00
Wim Taymans
2e5b462ae3 jitterbuffer: advance expected seqnum after dropping
After dropping a buffer, move our expected seqnum

Conflicts:
	gst/rtpmanager/gstrtpjitterbuffer.c
2013-11-13 12:02:57 +01:00
Wim Taymans
e4bc81d7d2 rtpsession: remove collision reconfigure event
Remove bogus reconfigure event on collision, we don't want to send the event on
the receiving RTP pad and the collision event is now handling this
case.

See https://bugzilla.gnome.org/show_bug.cgi?id=711560
2013-11-11 15:27:18 +01:00
Julien Isorce
b32fc6f416 gstrtpsession: send custom upstream event "GstRTPCollision" on send_rtp_sink pad
See https://bugzilla.gnome.org/show_bug.cgi?id=711560
2013-11-11 15:25:52 +01:00
George Kiagiadakis
b81b2efa3e rtpjitterbuffer: fix crash when do-retransmission=true and a lot of buffers are lost
The problem here was that the jitterbuffer lock was unlocked to push
the event, but that caused another thread to remove the timer currently
being processed, probably because the amount of rtx events
(and therefore timers) was getting too high. The solution is to
unlock and push the event only after timer processing has finished.

fixes https://bugzilla.gnome.org/show_bug.cgi?id=711131
2013-11-11 11:51:45 +01:00
Wim Taymans
c8db05d610 rtpsource: update receiver stats for sender
An internal sender in a session is also a receiver of its own packets so update
the receiver stats. Other senders in the session will use this info to generate
correct RB blocks in their SR reports.
2013-11-07 16:24:30 +01:00
Wim Taymans
268a75e705 rtpsource: refactor receiver stats update 2013-11-07 16:24:30 +01:00
Wim Taymans
e96f8f519c rtspsrc: proxy new buffer mode 2013-10-31 10:38:35 +01:00
Wim Taymans
43645d5981 jitterbuffer: add new timestamp mode
Add a new timestamp mode that assumes the local and remote clock are
synchronized. It takes the first timestamp as a base time and then uses the RTP
timestamps for the output PTS.
2013-10-31 10:15:25 +01:00
Wim Taymans
d4892859d4 jitterbuffer: fix race in flush-start/flush-stop
When flush-stop arrives before we process the result of the _push() in the
loop function, we might pause even though we are not flushing anymore. Fix this
race by waiting for the srcpad loop function to completely pause after doing the
flush-start.
2013-10-04 12:35:18 +02:00
Wim Taymans
00056965e8 rtpjitterbuffer: fix race when updating the next_seqnum
If we were not waiting for the missing seqnum when we insert the lost packet
event in the jitterbuffer, we end up not updating the next_seqnum and wait
forever for the lost packets to arrive. Instead, keep track of the amount of
packets contained by the jitterbuffer item and update the next expected
seqnum only after pushing the buffer/event. This makes sure we correctly handle
GAPS in the sequence numbers.
2013-09-30 12:31:00 +02:00
Wim Taymans
fde438791e rtpjitterbuffer: small debug improvement 2013-09-30 12:30:23 +02:00
Wim Taymans
6e7d547be4 rtpjitterbuffer: reset skew does not reset clock-rate
Don't reset the clock-rate when we reset the skew correction algorithm.
Reset the skew correction algorithm when we change the clock-rate.
2013-09-30 11:53:08 +02:00
Wim Taymans
03d520eb69 rtpjitterbuffer: pause timer when PAUSED
Also pause the timer when we go to the PAUSED state. It is possible that we
don't have a clock or base-time in PAUSED to perform the timeouts.
2013-09-30 11:16:32 +02:00
Wim Taymans
4a31aec513 rtpjitterbuffer: improve debug 2013-09-30 11:15:25 +02:00
Wim Taymans
d4b4b4e924 rtpjitterbuffer: don't calculate skew without rtptime
Skip trying to calculate the skew when we don't have an rtptime.
It causes problems when lost packet events are placed in the jitterbuffer.
2013-09-26 16:21:33 +02:00
Wim Taymans
2efd58fc84 rtpbin: avoid some pad link checks
Link pads without checks, we know it will work.
2013-09-25 17:38:31 +02:00
Wim Taymans
97f4674655 rtpjitterbuffer: calculate some stats 2013-09-25 10:50:05 +02:00
Wim Taymans
b1d29483bb rtpjitterbuffer: move send_lost_event function
Move the send_lost_event function to the do_lost_event handling, there is no
need to have a separate function.
2013-09-25 10:50:05 +02:00
Wim Taymans
adf5d96044 rtpmanager: update docs 2013-09-23 16:34:15 +02:00
Wim Taymans
e5019de80d docs: update docs with 1.0 element names 2013-09-23 15:36:47 +02:00
Wim Taymans
8ce674da87 rtpjitterbuffer: always store lost event in jitterbuffer
Always prepare a lost event in the jitterbuffer, it is to wake up and make the
pushing thread continue. We drop the event when we are not supposed to push lost
events downstream.
2013-09-23 14:45:27 +02:00
Wim Taymans
9f3345fcc2 rtpjitterbuffer: schedule lost event differently
Schedule the lost event by placing it inside the jitterbuffer with the seqnum
that was lost so that the pushing thread can interleave and push it properly.
2013-09-23 14:45:27 +02:00
Wim Taymans
ae389aeb0c rtpjitterbuffer: remove list debug 2013-09-23 14:45:26 +02:00
Wim Taymans
28641e3145 rtpjitterbuffer: add type to the item
So that the upper layer can know what data is contained in the item.
2013-09-23 14:45:26 +02:00
Wim Taymans
479c7642fd rtpjitterbuffer: fix flush
Pass function to flush to properly free the queue items.
2013-09-23 14:45:25 +02:00
Wim Taymans
0cc887eb98 rtpjitterbuffer: append seqnum -1 packets 2013-09-23 14:45:25 +02:00
Wim Taymans
39a2ba669d rtpjitterbuffer: use structure to hold packet information
Make the jitterbuffer operate on a structure containing all the packet
information. This avoids mapping the buffer multiple times just to get the RTP
information. It will also make it possible to store other miniobjects such as
events later.
2013-09-23 14:45:25 +02:00
Wim Taymans
1760817005 rtpjitterbuffer: update expected timer when possible
When we receive a packet and we have some missing packets, we can update their
estimated arrival times based on the timestamp difference.
2013-09-23 14:45:25 +02:00
Wim Taymans
fdc1ed1680 rtpjitterbuffer: fix order of timeout events
Improve the order of the timeout events, if there are timers with the same
timeout, we want to trigger the lowest seqnum first. For this we need to loop
over the complete array of timers to find the best one before triggering the
timeout.
2013-09-23 14:45:25 +02:00
Wim Taymans
0b1a7edfea rtpjitterbuffer: send lost event before signaling next buffer
First send the lost event, then update the next_seqnum counter and then
send the signal to the pushing thread that it can retry to push a buffer. This
avoids pushing out buffers before the lost event is pushed.
2013-09-23 14:45:25 +02:00
Wim Taymans
5051f51f0a jitterbuffer: configure clock-rate on jitterbuffer
Add a get and setter to configure the clock-rate in the jitterbuffer instead of
passing it as an argument to the insert method.
2013-09-23 14:45:24 +02:00
Wim Taymans
3c421e7e48 rtpjitterbuffer: add option to reset retransmission timers 2013-09-23 14:45:24 +02:00
Wim Taymans
6f4deab298 rtpjitterbuffer: stop the timer thread
The timeout code could release the lock so we need to check if we are allowed to
wait for the clock some more.
2013-09-23 14:45:24 +02:00
Wim Taymans
cba4e6a707 rtpjitterbuffer: unlock only once 2013-09-23 14:45:24 +02:00
Wim Taymans
5dc207948c rtpjitterbuffer: improve flush and shutdown
There is no need to unschedule the timer in flush-start, flush-stop will remove
the timers and unschedule.
Unschedule the current timer before attempting to join the timer thread.
2013-09-23 14:45:23 +02:00
Wim Taymans
a512cc2d3c rtpjitterbuffer: set correct expected time
When we already have a timer for a packet, skip it but don't forget to adjust
the dts to the expected dts of the next packet.
2013-09-23 14:45:23 +02:00
Wim Taymans
517ea0f4d9 jitterbuffer: improve debug 2013-09-23 14:45:23 +02:00
Wim Taymans
fd6c57cf10 rtpjitterbuffer: keep delay as a separate variable in timer
Keep a separate delay in the timer so that we still know the original timestamp
of the packet that this timer refers to. We can then place the correct
running-time in the Retransmission event.
2013-09-19 14:32:48 +02:00
Wim Taymans
d34184dd03 rtpjitterbuffer: fix writability of properties 2013-09-19 14:32:48 +02:00
Wim Taymans
6bb2626498 rtpjitterbuffer: reevaluate the current timer after timeout
When we trigger the timeout logic of a timer, reevaluate it because it is
possible that it still has the lowest timeout.
2013-09-18 16:33:40 +02:00
Wim Taymans
8d021b6ede rtpjitterbuffer: don't update time when unscheduled
Don't try to estimate the current time when we got unscheduled.
2013-09-18 16:31:26 +02:00
Wim Taymans
65606a25bf rtpjitterbuffer: init packet spacing on first buffer
Already init the packet spacing variables on the first buffer so that we can
calculate the spacing on the second buffer already.
2013-09-18 16:29:37 +02:00
Wim Taymans
f2efdf28f5 rtpjitterbuffer: push the lost event from the timer thread
Instead of pushing the lost event from the chain function, schedule a timeout
that will push the lost event from the timer thread. This avoid blocking the
upstream thread while we push and sync the event.
2013-09-18 14:57:09 +02:00
Wim Taymans
5d5fc03e04 rtpjitterbuffer: round gap duration to multiple of duration
Make sure the gap duration in the lost event is a multiple of the packet
duration.
Enable another test.
2013-09-18 14:12:47 +02:00
Wim Taymans
6e4a051d40 rtpjitterbuffer: keep track of duration
Keep track of the estimated duration of missing packets and use it in the lost
event.
Enable another unit test
2013-09-18 12:29:38 +02:00
Wim Taymans
ac3bb3acf6 rtpjitterbuffer: handle large gaps with one lost event
When we have a large number of missing packets, generate one lost event for all
the packets that have no chance of being pushed out in time.
Fix and activate unit test for large gaps.
2013-09-18 11:59:28 +02:00
Wim Taymans
26402e1c21 rtpjitterbuffer: refactor lost event sending
Also make sure we only increment the expected seqnum and last
output timestamp.
2013-09-18 11:57:06 +02:00
Wim Taymans
f49981a597 jitterbuffer: refactor timeout triggers 2013-09-17 23:29:56 +02:00
Wim Taymans
047021c443 jitterbuffer: simplify the timeout code
Keep track of the current time in the timeout loop.
Loop over all timers and trigger all the expired ones, we can do this in the
same loop that selects the new best timer.
2013-09-17 23:29:56 +02:00
Wim Taymans
fa1ef3328b jitterbuffer: rearrange timer update code
Also update the timers when retransmission is disabled. We need to
do this because when we added LOST timers when we detected missing packets and
we need to remove those timers when the packet finally arrives.
2013-09-17 23:29:56 +02:00
Wim Taymans
232fdd8b56 jitterbuffer: release lock on shutdown 2013-09-17 15:19:42 +02:00
Wim Taymans
4de919a17a jitterbuffer: use separate thread for timeouts
Use a separate thread for scheduling the timeouts instead of using the
downstream streaming thread that might block at any time.
2013-09-16 15:55:55 +02:00
Olivier Crête
b9ceafe5af rtpsession: Demux RTCP buffers from the RTP stream
If there are RTCP buffers in the RTP stream, process them as
RTCP. This way, we want receive streams following RFC 5761

https://bugzilla.gnome.org/show_bug.cgi?id=687657
2013-09-13 16:25:49 +02:00
Wim Taymans
28e5f90988 rtpbin: use PacketInfo for the sender
Avoid mapping the packet multiple times when sending RTP.
2013-09-13 14:34:28 +02:00
Wim Taymans
a02c9473d8 rtpbin: store more in the PacketInfo
Store all info in the PacketInfo so that we can avoid mapping the packet
multiple times.
2013-09-13 14:34:28 +02:00
Wim Taymans
e5c789abd6 session: store more in the PacketInfo structure 2013-09-13 14:34:28 +02:00
Wim Taymans
47662f9ca4 rtpbin: RTPArrivalStats -> RTPPacketInfo
Rename a structure because we are also going to use this for the sender
bits.
2013-09-13 14:34:28 +02:00
Wim Taymans
c795b72988 source: small cleanups 2013-09-13 14:34:27 +02:00
Wim Taymans
9f9ba21404 jitterbuffer: handle segments with non-0 start
We keep the DTS and PTS in running-time inside the jitterbuffer. Make sure to
transform it back to a buffer timestamp before pushing out the buffer.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=707931
2013-09-12 15:04:30 +02:00
Wim Taymans
f1106cde66 session: only update next check time when reconsidering
Don't update the next RTCP check time in all cases but only when we
reconsidered. This avoids delaying sending a full RTCP packet when we
are doing early feedback.
2013-08-27 09:55:52 +02:00
Wim Taymans
47065db0b6 session: add more debug 2013-08-27 09:55:52 +02:00
Wim Taymans
454d75951e jitterbuffer: fix types of the retransmission event 2013-08-27 09:55:52 +02:00
Wim Taymans
dd4af0d11c jitterbuffer: only timeout EXPECTED timers on gap
Only timeout the EXPECTED timers when we detect a large seqnum gap.
2013-08-27 09:44:18 +02:00
Wim Taymans
4b7bcc2ec1 rtsession: fix locking
We need to take the session lock when getting and manipulating the
source.
2013-08-26 11:50:27 +02:00
Wim Taymans
3f46527f75 rtpsession: add some more debug 2013-08-26 11:50:13 +02:00
Wim Taymans
54e7e7547a rtxqueue: add property to configure queue size 2013-08-23 15:47:25 +02:00
Wim Taymans
84833bed11 rtpbin: proxy jitterbuffer do-retransmission property 2013-08-23 12:10:19 +02:00
Wim Taymans
89b9019e3e rtx: various improvements
Use locking
Don't push from the event handler, collected packets in a queue and push from
the chain function.
Clear queues on shutdown.
2013-08-21 17:02:27 +02:00
Wim Taymans
ee15bc9284 session: generate events correctly
Do correct shifting of the bitmask for lost packets.
2013-08-21 17:02:27 +02:00
Wim Taymans
67523d3ecb rtp: register rtx element better 2013-08-21 17:02:26 +02:00
Wim Taymans
587dc055e9 jitterbuffer: handle EOS
When the queue is empty, and we received EOS, pause and push an EOS
event downstream.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=706387
2013-08-20 14:36:59 +02:00
Wim Taymans
533f26fc99 jitterbuffer: update docs 2013-08-20 10:26:15 +02:00
Wim Taymans
c7f9ef8012 jitterbuffer: update all timers
Keep looping over all registered timers so that we can mark them lost instead of
stopping as soon as we find the timer for the current seqnum.
2013-08-20 10:25:17 +02:00
Wim Taymans
5debda9ca1 jitterbuffer: remove unused variables 2013-08-20 08:55:50 +02:00
Wim Taymans
a88db5fa2c jitterbuffer: reorganize timer handling
Restructure handling of incomming packet and the gap with the expected seqnum
and register all timers from the _chain function.
Convert a timer to a LOST packet timer when the max amount of retransmission
requests has been reached.
2013-08-19 22:04:51 +02:00
Wim Taymans
d9d6eac4bb jitterbuffer: refactor packet spacing calculation 2013-08-19 22:04:50 +02:00
Wim Taymans
c4dc159656 jitterbuffer: keep track of last seqnum and dts 2013-08-19 22:04:50 +02:00
Wim Taymans
652ce95ca6 jitterbuffer: small cleanups 2013-08-19 22:04:50 +02:00
Wim Taymans
b4a35bbe82 jitterbuffer: reset retransmission timers in add/reschedule
Reset the retransmission timers when adding and rescheduling a timer.
2013-08-19 22:04:50 +02:00
Wim Taymans
cf8a0652f3 jitterbuffer: rename variables for packet spacing 2013-08-19 22:04:50 +02:00
Wim Taymans
ec82e4ab7c jitterbuffer: remove lost timer when we get the packet
When we receive a packet, also remove the LOST timer for it.
2013-08-19 22:04:50 +02:00
Wim Taymans
2f03b43b21 jitterbuffer: expected seqnum must increase
Only update the expected seqnum when it is bigger than the previous expected
seqnum.
2013-08-19 22:04:50 +02:00
Wim Taymans
c5bf376bb5 jitterbuffer: add more debug 2013-08-19 22:04:50 +02:00
Wim Taymans
ff825a2919 rtxqueue: add retransmission queue element 2013-08-19 22:04:50 +02:00
Wim Taymans
5fe18ee432 session: add some docs 2013-08-19 22:04:49 +02:00
Wim Taymans
482dacfb54 session: handle NACK feedback and generate events
Handle and parse the feedback NACK packets and generate a Retransmission
event for each NACKed packet
2013-08-19 22:04:49 +02:00
Wim Taymans
f11c2c9b3b jitterbuffer: forward flush before stopping dataflow
First forward the flush event and then stop our loop function.
2013-08-14 16:19:32 +02:00
Wim Taymans
48174164eb session: add NACK feedback in RTCP 2013-08-06 15:50:19 +02:00
Wim Taymans
4379ed1dee source: add methods to register NACK
Add a method to register a missing packet for an ssrc along with
methods to get the missing packets and clear them.
2013-08-06 15:50:19 +02:00
Wim Taymans
50638b8106 session: handle Retransmission event and schedule NACK
Handle the retransmission event from downstream and use it to schedule a NACK
request.
2013-08-06 15:50:19 +02:00
Wim Taymans
0bddbd682d session: pass data to remove func
Pass the data to the remove function because we are going to deref it when there
is pli or fir.
2013-08-06 15:50:19 +02:00
Wim Taymans
3c82de59f9 session: use common send_rtcp method
Reuse the send_rtcp method that already asks for the current time when
requesting a keyframe.
2013-08-05 15:02:59 +02:00