Commit graph

809 commits

Author SHA1 Message Date
Wim Taymans 4379ed1dee source: add methods to register NACK
Add a method to register a missing packet for an ssrc along with
methods to get the missing packets and clear them.
2013-08-06 15:50:19 +02:00
Wim Taymans 50638b8106 session: handle Retransmission event and schedule NACK
Handle the retransmission event from downstream and use it to schedule a NACK
request.
2013-08-06 15:50:19 +02:00
Wim Taymans 0bddbd682d session: pass data to remove func
Pass the data to the remove function because we are going to deref it when there
is pli or fir.
2013-08-06 15:50:19 +02:00
Wim Taymans 3c82de59f9 session: use common send_rtcp method
Reuse the send_rtcp method that already asks for the current time when
requesting a keyframe.
2013-08-05 15:02:59 +02:00
Wim Taymans 3c14c6021c session: Don't use ClockTimeDiff for unsigned delays 2013-08-05 15:02:59 +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 9613e481ad session: add FIR and PLI like other RTCP packets
Add the FIR and PLI packets like the other RTCP packet instead of from the
on-sending-rtcp default signal handler.
2013-08-03 00:33:24 +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 ea931d4f57 rtpjitterbuffer: use NULL to ignore percent
If we pass NULL to pop and push we ignore the percent result.
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 02359f9219 session: don't make buffer writable prematurely
There is no reason to make the SR buffer writable at this point. This is better
delayed until needed.
2013-07-26 22:31:41 +02:00
Wim Taymans 0261199fc4 session: ignore RTCP for inactive sources 2013-07-26 22:31:23 +02:00
Wim Taymans a4b4ca53c0 session: small cleanup 2013-07-26 22:25:17 +02:00
Wim Taymans e0abd2e9b5 session: handle partial RTCP report blocks
When we have more SSRCs to report than what fit in an RTCP packet, use a
generation counter to make sure all of them end up in a packet eventually.
2013-07-26 17:29:10 +02:00
Wim Taymans 6cce6fb04c session: create SSRC before doing session cleanup
Make the internal source before we do session cleanup
2013-07-26 17:29:10 +02:00
Wim Taymans 5b0298c63e session: reorganize the report block code 2013-07-26 17:29:10 +02:00
Wim Taymans 3c44cd7c83 session: refactor active and sender checks 2013-07-26 14:21:40 +02:00
Wim Taymans e952f7ba43 session: remove internal sources on timeout
When an internal source times out and becomes a receiver, remove it.
2013-07-26 12:18:01 +02:00
Wim Taymans e9e2fe3950 session: create an internal source for RTCP
When we need to do RTCP and we don't have an internal source yet,
make one.
2013-07-26 12:18:01 +02:00
Wim Taymans bd0709c15c session: remove old code to change SSRC
Remove code used to change the SSRC after a collision. We now send
a RECONFIGURE event upstream to make the upstream element change the SSRC.
2013-07-26 12:18:01 +02:00
Wim Taymans 88f5a5f355 source: don't update packet SSRC
Remove the code to update the SSRC in packets, it can never be called now that
we always use a source with matching packet SSRC.
2013-07-26 12:18:01 +02:00
Wim Taymans abc90da1dc session: delay allocation of internal source
Allocate the internal source when we receive a caps with the SSRC or when we see
a buffer with the SSRC.
2013-07-26 12:18:01 +02:00
Wim Taymans e0a1ce1291 session: generate reconfigure on collision
When we detect a collision, change the SSRC that we suggest upstream
and trigger RECONFIGURE. This should make upstream select a new SSRC.
2013-07-26 12:18:01 +02:00
Wim Taymans 495d43c089 session: produce RTCP for all internal sources
Loop over all the internal sources and produce RTCP. We also need
to queue the RTCP packets and send them when we are finished.
2013-07-26 12:18:00 +02:00
Wim Taymans 9505fd4150 session: deprecate internal source and ssrc properties
Deprecate the internal source and internal ssrc properties. There might
be more than one internal source.
2013-07-26 12:17:59 +02:00
Wim Taymans 3d6ee1fb5e session: internal sources don't use probation 2013-07-26 12:17:59 +02:00
Wim Taymans 0e53e9109e session: give caps to session
Let the session parse the caps and update its SSRC when needed.
2013-07-26 12:17:59 +02:00
Wim Taymans c06482a2cb session: make method to suggest available SSRC
Make a method to suggest the best available SSRC. This is the SSRC of the last
created internal source and is used to instruct upstream to produce this
SSRC.
2013-07-26 12:17:59 +02:00
Wim Taymans 33ce50e8b1 session: keep SDES and set on new internal sources
Keep track of the SDES ourselves and set it on all newly created
internal sources.
2013-07-26 12:17:59 +02:00
Wim Taymans 5652f02b76 session: make method to make internal sources
Add a method to obtain an internal source and use it to create
our internal source
2013-07-26 12:17:59 +02:00
Wim Taymans 7f83927c95 session: count internal sources and how many are senders 2013-07-26 12:17:58 +02:00
Wim Taymans 719343c206 rtpsession: separate BYE marking and scheduling
First mark sources with BYE and then schedule the BYE RTCP message.
2013-07-26 12:17:58 +02:00
Wim Taymans 391943ba82 session: get SSRC from RTCP packet itself
Get the SSRC from the RTCP packet instead.
2013-07-26 12:17:57 +02:00
Wim Taymans a3f75a17ef session: fix bandwidth calculation
We iterate over all sources and the internal one is also in the
hashtable so avoid adding it twice.
2013-07-26 12:17:57 +02:00
Wim Taymans 9eaef9d332 session: add some docs 2013-07-26 12:17:56 +02:00
Wim Taymans 2163355a47 session: Rearrange RTCP reporting a little
Make a function to generate an RTCP packet for a source, pass the source as a
parameter.
Move timeout of collisions to session cleanup phase.
2013-07-26 12:17:56 +02:00
Wim Taymans a3bf374351 session: move check for is_early around
Move the check for the early RTCP to where it is needed and used.
2013-07-26 12:17:56 +02:00
Wim Taymans b069db6a2e session: parse packet outside of the session lock 2013-07-26 12:17:56 +02:00
Wim Taymans 57c27ec319 session: do nicer checks for internal sources 2013-07-26 12:17:56 +02:00
Wim Taymans 93d07298ff session: let source keep track if it sent BYE 2013-07-26 12:17:56 +02:00
Wim Taymans 0c9c1434a8 source: reset more 2013-07-26 12:17:56 +02:00
Wim Taymans 1d02496d15 source: also use the source for bye_reason
Store the BYE reason in our internal source object. Rename the methods on the
source object a little because now the BYE can be received in RTCP or
set when the session wants to send BYE.
2013-07-26 12:17:56 +02:00
Wim Taymans ddd071e54c session: configure sdes with structure only
Remove code to configure the SDES with methods and types, only
allow configuration with GstStructure
2013-07-26 12:17:55 +02:00
Wim Taymans 0060e1d45d session: refactor add and find source
Make functions to find and add a source to the hashtable.
2013-07-26 12:17:55 +02:00
Wim Taymans adb0d68c07 session: remove source from sync_rtcp
We don't need to know the sender source of the session in the
callback, the SR packet is for all participants in the session.
2013-07-26 12:17:55 +02:00
Wim Taymans bf7d8173b3 jitterbuffer: add some more debug 2013-07-26 12:17:55 +02:00
Wim Taymans c44a29bd53 bin: fix compilation 2013-07-24 14:17:45 +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 dece8413ef rtpsession: don't use invalid times in RTCP timeouts
An invalid timeout can be calculated when we disabled RTCP by setting the
bandwidth to 0. Make sure all code can handle this case.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=674626
2013-07-23 17:41:48 +02:00
Wim Taymans 25e0f0d6b6 rtpsession: lock session when changing bandwidth
Take the session lock when changing the bandwidth properties so that we don't
end up with inconsistent behaviour.
2013-07-23 17:41:48 +02:00
Wim Taymans c337265ee4 session: reset some RTCP variables
The early_send time was set to 0 and always triggering an early RTCP packet.
2013-07-23 17:41:48 +02:00
Carlos Rafael Giani 95429f1d4b rtpbin: added custom downstream sync event
rtpbin can now send a custom in-band downstream event which informs
downstream that the bin has received an RTCP SR packet. This is useful
for applications which want to drop the initial unsynchronized received
RTP packets.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=703560

Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
2013-07-23 06:25:20 +02:00
Sebastian Dröge 5a9f4a3cbc rtpsession: Add support for group-id in the stream-start event 2013-07-22 15:30:13 +02:00
Olivier Crête 3aa20e7c8d rtpmux: Enable proxy caps on the src pads 2013-07-11 17:21:22 -04:00
Olivier Crête 1997acc8b2 rtpmux: Keep caps order from the peer or the filter 2013-07-09 17:43:31 -04:00
J. Rick Ramstetter f01b751e52 rtp: Fix documentation and comments to use rtpbin instead of old gstrtpbin
https://bugzilla.gnome.org/show_bug.cgi?id=703426
2013-07-02 10:12:17 +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
Olivier Crête 2cd6f53e24 rtpptdemux: Wait after the caps to forward the other events
First forward the stream-start, then the caps, then the rest
2013-06-20 23:16:59 -04:00
Wim Taymans 51c9f7989f rtpsession: Use the right hashtable to calculate bandwidth
Don't use an unused hashtable to iterate source to calculate bandwidth.
Remove unused code.
2013-06-13 16:02:19 +02:00
Wim Taymans 63f0ecbbe7 rtpsession: send stream-start and segment events
Also send stream-start and segment event on the RTCP pad.
We don't need to send anything on the sync_src pad because we
already forwarded all incomming events.
2013-05-28 12:26:25 +02:00
Nicolas Dufresne 04c9f43567 rtpmux: Send stream-start before caps 2013-05-13 15:37:05 +02:00
Sebastian Dröge b0b0557c48 gst: Add better support for static plugins 2013-04-15 15:54:11 +02:00
Olivier Crête 6f3734c305 rtpssrcdemux: Only forward stick events while holding the sinkpad stream lock
Otherwise we get a race where if the RTCP packet comes in first and while
it is added the pads, the segment event arrives on the RTP stream, the event
may be lost completely and never forwarded.
2013-04-02 23:42:42 -04:00
Olivier Crête 76679f9ae9 rtpssrcdemux: No need to explicitely forward the caps
They are forwarded with the other events
2013-04-02 23:42:41 -04:00
Olivier Crête 4ad8693f3c rtpssrcdemux: Remove unused GstSegment 2013-04-02 23:42:41 -04:00
Olivier Crête 7293b0eff7 rtpssrcdemux: Simplify event forwarding
Use the gst_pad_forward() mechanic, this way we won't miss pads that are
added while we are pushing
2013-04-02 23:42:41 -04:00
Olivier Crête f4c3aef13a rtpssrcdemux: Don't cross the internal links
We had the wrong condition to check for the internal links, so RTP and RTCP
pads got crossed!
2013-04-02 23:42:41 -04:00
Paul HENRYS 10802cae73 rtpsession: Fix wrong code organisation in case of collision
change_ssrc field of RTPSession should be set before calling
rtp_session_schedule_bye_locked () as this function will call reconsider function
that will wake up rtcp_thread which will call rtp_session_on_timeout () that will
check change_ssrc to change the ssrc.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=694184
2013-02-22 09:28:07 +02:00
Wim Taymans a61055809f rtpsession: only delay RTCP when we are a sender
Only delay the RTCP thread when we are a sender, which we can know because we
have a send_rtp_src pad. Otherwise we might delay the RTCP thread if we
are only a receiver and then there is no code path that wakes up the
RTCP thread and we end up without RTCP packets.
2013-02-20 21:07:41 +02:00
Wim Taymans 2d5319c1fa rtpsession: delay RTCP until first RTP packet
Delay sending the first RTCP packet until we have sent the first RTP packet.
Otherwise we will send out a Receiver Report instead of a sender report.

See https://bugzilla.gnome.org/show_bug.cgi?id=691400
2013-02-08 17:05:27 +01:00
Wim Taymans 2971ed44ee rtpsession: remove dead code
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=668355
2013-02-07 15:06:40 +01:00
Paul HENRYS 0e91c949d8 rtpptdemux: forward sticky events and then set caps
When a new src pad is added, first forward the sticky events and then
set the caps on the src pad

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=692786
2013-02-07 14:38:20 +01:00