Commit graph

217 commits

Author SHA1 Message Date
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