Commit graph

195 commits

Author SHA1 Message Date
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
Wim Taymans f87875e35b rtpjitterbuffer: fix locking
Take the lock earlier so that we do things that follow with the right
locking.
2013-07-24 10:49:03 +02:00
Wim Taymans 519305d14d jitterbuffer: improve sync on first packets
Don't throw away the first RTCP packet if it arrives before the first
RTP packet but remember and use it to signal sync once we get the
RTP packet.

See https://bugzilla.gnome.org/show_bug.cgi?id=691400
2013-06-27 16:23:20 +02:00