Commit graph

191 commits

Author SHA1 Message Date
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
Wim Taymans
8969f00661 jitterbuffer: only signal loop when active
Only signal the loop function when it is active.
2013-06-27 16:15:45 +02:00
Wim Taymans
4bd2ffb26e jitterbuffer: signal timestamp discont
We can now use the RESYNC buffer flag to mark a timestamp discont when we update
the ts-offset property.
2013-06-27 16:13:37 +02:00
Wim Taymans
af055d9574 jitterbuffer: refactor handle sync code
Move the code that combines the last SR packet and the current jitterbuffer sync
values into a sync structure, into its own function. We want to reuse this bit
later.
2013-01-07 15:50:33 +01:00
Havard Graff
9c94f1187c jitterbuffer: bundle together late lost-events
The scenario where you have a gap in a steady flow of packets of
say 10 seconds (500 packets of with duration of 20ms), the jitterbuffer
will idle up until it receives the first buffer after the gap, but will
then go on to produce 499 lost-events, to "cover up" the gap.

Now this is obviously wrong, since the last possible time for the earliest
lost-events to be played out has obviously expired, but the fact that
the jitterbuffer has a "length", represented with its own latency combined
with the total latency downstream, allows for covering up at least some
of this gap.

So in the case of the "length" being 200ms, while having received packet
500, the jitterbuffer should still create a timeout for packet 491, which
will have its time expire at 10,02 seconds, specially since it might
actually arrive in time! But obviously, waiting for packet 100, that had
its time expire at 2 seconds, (remembering that the current time is 10)
is useless...

The patch will create one "big" lost-event for the first 490 packets,
and then go on to create single ones if they can reach their
playout deadline.

See https://bugzilla.gnome.org/show_bug.cgi?id=667838
2012-12-13 12:00:43 +01:00