Commit graph

833 commits

Author SHA1 Message Date
Wim Taymans
d4b4b4e924 rtpjitterbuffer: don't calculate skew without rtptime
Skip trying to calculate the skew when we don't have an rtptime.
It causes problems when lost packet events are placed in the jitterbuffer.
2013-09-26 16:21:33 +02:00
Wim Taymans
2efd58fc84 rtpbin: avoid some pad link checks
Link pads without checks, we know it will work.
2013-09-25 17:38:31 +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
ae389aeb0c rtpjitterbuffer: remove list debug 2013-09-23 14:45:26 +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
0cc887eb98 rtpjitterbuffer: append seqnum -1 packets 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
Olivier Crête
b9ceafe5af rtpsession: Demux RTCP buffers from the RTP stream
If there are RTCP buffers in the RTP stream, process them as
RTCP. This way, we want receive streams following RFC 5761

https://bugzilla.gnome.org/show_bug.cgi?id=687657
2013-09-13 16:25:49 +02:00
Wim Taymans
28e5f90988 rtpbin: use PacketInfo for the sender
Avoid mapping the packet multiple times when sending RTP.
2013-09-13 14:34:28 +02:00
Wim Taymans
a02c9473d8 rtpbin: store more in the PacketInfo
Store all info in the PacketInfo so that we can avoid mapping the packet
multiple times.
2013-09-13 14:34:28 +02:00
Wim Taymans
e5c789abd6 session: store more in the PacketInfo structure 2013-09-13 14:34:28 +02:00
Wim Taymans
47662f9ca4 rtpbin: RTPArrivalStats -> RTPPacketInfo
Rename a structure because we are also going to use this for the sender
bits.
2013-09-13 14:34:28 +02:00
Wim Taymans
c795b72988 source: small cleanups 2013-09-13 14:34:27 +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
f1106cde66 session: only update next check time when reconsidering
Don't update the next RTCP check time in all cases but only when we
reconsidered. This avoids delaying sending a full RTCP packet when we
are doing early feedback.
2013-08-27 09:55:52 +02:00
Wim Taymans
47065db0b6 session: add more debug 2013-08-27 09:55:52 +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
4b7bcc2ec1 rtsession: fix locking
We need to take the session lock when getting and manipulating the
source.
2013-08-26 11:50:27 +02:00