Commit graph

397 commits

Author SHA1 Message Date
Sangkyu Park
6696bd62ef rtpjitterbuffer: Minor cleanup
1. Add Null check in 'free_item' function.
2. Fix a typing error of comment.

https://bugzilla.gnome.org/show_bug.cgi?id=750965
2015-06-15 11:55:57 +02:00
Sebastian Dröge
8f5bdf9690 rtpjitterbuffer: Add support for receiving reduced size RTCP
It worked before but gave warnings, now we just ignore RTCP
packets that don't start with a SR. As all we're interested
in here are SRs.
2015-06-05 10:33:11 +02:00
Sebastian Dröge
ca110fb0b8 rtpjitterbuffer: When detecting a huge seqnum gap, wait for 5 consecutive packets before resetting everything
It might just be a late retransmission or spurious packet from elsewhere, but
resetting everything would mean that we will cause a noticeable hickup. Let's
get some confidence first that the sequence numbers changed for whatever
reason.

https://bugzilla.gnome.org/show_bug.cgi?id=747922
2015-05-18 18:43:15 +03:00
Ilya Konstantinov
fd391a5404 rtpjitterbuffer: Fix "stats" property docs
https://bugzilla.gnome.org/show_bug.cgi?id=748436
2015-04-26 21:15:44 +02:00
Luis de Bethencourt
671b4d25cd remove unused enum items PROP_LAST
This were probably added to the enums due to cargo cult programming and are
unused. Removing them.
2015-04-24 17:01:12 +01:00
Sebastian Dröge
edcc5be297 rtpjitterbuffer: When request retransmissions for future packets, consider the packet spacing in the extra delay
We now take the maximum of 2*jitter and 0.5*packet_spacing for the extra
delay. If jitter is very low, this should prevent unnecessary retransmission
requests to some degree.

https://bugzilla.gnome.org/show_bug.cgi?id=748041
2015-04-22 20:27:18 +02:00
Sebastian Dröge
3fe8ceff14 rtpjitterbuffer: Take a running average of the packet spacings instead of just the latest
https://bugzilla.gnome.org/show_bug.cgi?id=748041
2015-04-22 20:25:43 +02:00
Miguel París Díaz
f81c9a9568 rtpjitterbuffer: Add "rtx-next-seqnum" property
If this is set to FALSE, rtpjitterbuffer will not request retransmissions for
future packets based on when they are estimated to arrive.

See also https://bugzilla.gnome.org/show_bug.cgi?id=748041

https://bugzilla.gnome.org/show_bug.cgi?id=739868
2015-04-22 19:51:18 +02:00
Miguel París Díaz
c4bb6a098b rtpjitterbuffer: Add "rtx-max-retries" property
This property allows to limit the maximum number of retransmission
for a specific packet.

https://bugzilla.gnome.org/show_bug.cgi?id=739868
2015-04-13 09:09:03 +02:00
Miguel París Díaz
05bd708fc5 rtpjitterbuffer: Fix expected_dts calc in calculate_expected
Right above we consider lost_packet packets, each of them having duration,
as lost and triggered their timers immediately. Below we use expected_dts
to schedule retransmission or schedule lost timers for the packets that
come after expected_dts.

As we just triggered lost_packets packets as lost, there's no point in
scheduling new timers for them and we can just skip over all lost packets.

https://bugzilla.gnome.org/show_bug.cgi?id=739868
2015-04-13 09:06:33 +02:00
Sebastian Dröge
1a2f253c3a rtpjitterbuffer: Make the next output buffer discont after resetting the jitterbuffer
Resetting the jitterbuffer drops all packets and other things, and will cause
a discontinuity in the packets received by the depayloaders. They should now
also flush anything they had pending as the new data will start at a different
position.

https://bugzilla.gnome.org/show_bug.cgi?id=739868
2015-04-13 09:05:34 +02:00
Nicolas Dufresne
12762ad1a5 rtpjitter: Account for rtx_retry in overflow check
As rtx_retry is part of the substraction, we need to take it into
account, otherwise we may endup with a big value.
2015-03-25 15:25:56 -04:00
Sebastian Dröge
9e934d076b rtpjitterbuffer: Drop packets with sequence numbers before the seqnum-base
These are outside the expected range of sequence numbers and should be
clipped, especially for RTSP they might belong to packets from before a seek
or a previous stream in general.
2015-03-09 11:10:35 +01:00
Sebastian Dröge
38bf3d3808 rtpjitterbuffer: Don't forget to unlock the mutex when receiving GAPs in TCP streams 2015-03-09 10:05:14 +01:00
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
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
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
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
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
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
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
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
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
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
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
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
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
Tim-Philipp Müller
7469cd3a4c rtpmanager: use generic marshaller 2013-08-04 11:03:07 +01:00
Wim Taymans
7584f91f31 jitterbuffer: send event in right direction 2013-08-04 00:24:36 +02:00
Wim Taymans
743e1b1191 jitterbuffer: fix property ranges 2013-08-02 17:22:55 +02:00
Wim Taymans
cd0164f4cc jitterbuffer: push retransmission events 2013-08-02 16:43:59 +02:00
Wim Taymans
9a13267e85 jitterbuffer: add support for retransmission retry
When we didn't receive a packet after requesting retransmission, retry
asking for retransmission for a certain period.
2013-08-02 14:54:56 +02:00
Wim Taymans
e9ad5126db jitterbuffer: add properties
Add properties to control retransmission parameters
2013-08-02 14:47:56 +02:00
Wim Taymans
a8c7ff7489 jitterbuffer: use corrected timeout when rescheduling
When we recalculate the timeout, use the corrected timeout value depending on
the timer type.
2013-08-02 12:44:58 +02:00
Wim Taymans
9c7e3e3455 jitterbuffer: update timers after queueing
Else we might update the timer needlessly for duplicates.
2013-08-02 12:43:00 +02:00
Wim Taymans
ebd6b8f8ab jitterbuffer: move method up 2013-08-02 12:42:08 +02:00
Wim Taymans
f6b6797874 jitterbuffer: small cleanup 2013-08-02 06:28:32 +02:00
Wim Taymans
0e41414926 jitterbuffer: unschedule old expected packets
When we receive a new packet, unschedule old outstanding packets when their
seqnum is too far away.
2013-08-01 23:36:07 +02:00
Wim Taymans
70695466ed jitterbuffer: refactor timer update 2013-08-01 23:32:00 +02:00
Wim Taymans
4ab3f5d3da jitterbuffer: update timers when removing
Update the timers when we remove a timer.
Handle canceled timers, make them unschedule the current timer and
trigger the timeout code.
2013-08-01 23:24:29 +02:00
Wim Taymans
b983cf675b jitterbuffer: fix typo 2013-08-01 23:22:02 +02:00
Wim Taymans
f3c658cbe6 jitterbuffer: improve timeout management
If we change the seqnum of an existing timer and we were waiting for
that timer, unschedule it. If we change the timeout of an existing timer and we
were waiting on it, only unschedule when the new time is smaller.
2013-08-01 15:40:52 +02:00
Wim Taymans
77e5d320ab jitterbuffer: install timer for expected arrival
Install a timer that is triggered when the expected arrival time of a packet
expired.
2013-08-01 15:11:13 +02:00
Wim Taymans
f08d98404e jitterbuffer: improve unschedule of timers
Conflicts:
	gst/rtpmanager/gstrtpjitterbuffer.c
2013-08-01 14:57:11 +02:00
Wim Taymans
9d3b824e2a jitterbuffer: move code around 2013-08-01 12:21:53 +02:00
Wim Taymans
fe32e80c92 jitterbuffer: estimate inter packet spacing
When we see two packets with consecutive seqnums and a different RTP time, use
the DTS difference as the inter packet spacing estimate.
2013-08-01 12:07:11 +02:00
Wim Taymans
255b7106f5 jitterbuffer: keep track of current timeout 2013-08-01 12:01:15 +02:00
Wim Taymans
7e43dba19b jitterbuffer: cleanup timer handling 2013-08-01 11:49:10 +02:00
Wim Taymans
9d88ac9cbb jitterbuffer: reset is only possible with a GAP 2013-08-01 11:40:41 +02:00
Wim Taymans
f864131227 jitterbuffer: operate on DTS
Make the jitterbuffer schedule the timeouts based on the DTS instead
of the PTS. This makes it all smoother with reordered frames and gives
the decoder time to reorder the frames in time.
2013-08-01 11:36:56 +02:00
Wim Taymans
80c5934290 jitterbuffer: rename timout variable 2013-08-01 11:14:12 +02:00
Wim Taymans
aa951433ee jitterbuffer: small cleanup 2013-07-31 17:08:58 +02:00
Wim Taymans
69c78f72d5 jitterbuffer: block output in paused or buffering 2013-07-31 16:59:58 +02:00
Wim Taymans
4fbbc53a49 jitterbuffer: store pts in timer
Only store the pts in the timer so that we can both do timeouts with timings on
the input and output of the jitterbuffer.
2013-07-31 16:59:09 +02:00
Wim Taymans
77846d35c6 rtpjitterbuffer: refactor jitterbuffer
Refactor the jitterbuffer code. Make separate function for peeking a buffer,
pushing the next buffer, waiting for timeouts and handling the timeouts.

The main loop now tries to push as many buffers as it can until it runs out of
buffers or when it detects a seqnum discont. Then it will wait for some event to
happen before attempting to push more buffers.

Make methods to register timeouts in an array. These timeouts are registered
when we detect a missing packet, sync for the first packet or when we find an
estimation for the end-of-stream.

This greatly simplifies and clarifies the code and also makes it possible to
register more complicated timeout schemes later.
2013-07-30 23:24:23 +02:00
Wim Taymans
b3e8a85a54 jitterbuffer: refactor
Move eos estimation into separate function
2013-07-30 23:24:22 +02:00
Wim Taymans
bf7d8173b3 jitterbuffer: add some more debug 2013-07-26 12:17:55 +02:00