Commit graph

274 commits

Author SHA1 Message Date
Wim Taymans
09f179139d rtpjitterbuffer: make debug line less confusing 2014-10-21 13:10:53 +02: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
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
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
Mark Nauwelaerts
6c584bc833 rtpjitterbuffer: avoid stall by corrupted seqnum accounting 2014-05-04 13:38:26 +02: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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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