Commit graph

105 commits

Author SHA1 Message Date
Havard Graff 342686bb02 jitterbuffer: Make upstream events MT-safe 2011-04-08 15:21:46 +02:00
Sebastian Dröge 31af4fe33e rtp: Unref events if the parent element disappeared 2011-04-08 15:20:51 +02:00
Ole André Vadla Ravnås 046f170d6a rtpmanager: fix pad callbacks so they handle when parent goes away
1) We need to lock and get a strong ref to the parent, if still there.
2) If it has gone away, we need to handle that gracefully.

This is necessary in order to safely modify a running pipeline. Has been
observed when a streaming thread is doing a buffer_alloc() while an
application thread sends an event on a pad further downstream, and from
within a pad probe (holding STREAM_LOCK) carries out the pipeline plumbing
while the streaming thread has its buffer_alloc() in progress.
2011-04-08 15:16:56 +02:00
Mark Nauwelaerts e5bcaa45e6 Revert "jitterbuffer: reset element base_time upon flush"
This reverts commit f84b8a69cb.

Fixes bug #646397.
2011-04-04 11:49:00 +02:00
Mark Nauwelaerts 6bc1aa0e59 jitterbuffer: handle position query 2011-03-09 17:18:08 +01:00
Mark Nauwelaerts 1f7f434df6 jitterbuffer: also estimate eos if very near eos 2011-03-07 16:56:43 +01:00
Mark Nauwelaerts 3c9a4239bf jitterbuffer: avoid trying to buffer more than is available.
That is, in case of short (or near eos of) stream, deadlock (until timeout)
would occur trying to buffer more than is yet forthcoming.
2011-03-07 16:56:18 +01:00
Mark Nauwelaerts f84b8a69cb jitterbuffer: reset element base_time upon flush
... to arrange for properly scheduled timeout (following seek).
2011-03-07 11:07:12 +01:00
Wim Taymans 6cb0efede4 jitterbuffer: provide a clock.
since we are using the clock for sync, we need to also provide a clock for good
measure. The reason is that even if downstream elements provide a clock, we
don't want to have that clock selected because it might not be running yet.
2010-12-20 11:13:09 +01:00
Wim Taymans ffc7cd9803 jitterbuffer: avoid leaking sink events
Avoid leaking the newsegment event when it has the wrong format.
2010-12-13 12:57:58 +01:00
Stefan Kost d8167e3071 various (gst): add a missing G_PARAM_STATIC_STRINGS flags 2010-10-13 18:00:28 +03:00
Pascal Buhler 7a8c2a4b8a rtpmanager: packet lost should not be a warning. It happens all the time... 2010-09-24 16:00:03 +02:00
Wim Taymans f03fd91400 jitterbuffer: rename a variable to avoid confusion 2010-09-06 11:01:57 +02:00
Sebastian Dröge f16ed4a91c gst: Don't use GST_DEBUG_FUNCPTR for GObject vfuncs 2010-06-06 17:52:40 +02:00
Thijs Vermeir 0bb2be3a7e rtpjitterbuffer: fix compiler warning
unused variable ‘estimated’
2010-06-02 15:32:36 +02:00
Alessandro Decina 4b6cb93025 rtpjitterbuffer: stop buffering and emit EOS at the end of a stream
When using RTP_JITTER_BUFFER_MODE_BUFFER, make sure that the ringbuffer doesn't
get stuck buffering forever when there isn't enough data left to fill the
buffer.
2010-06-02 14:21:16 +02:00
Alessandro Decina 40899379c0 rtpjitterbuffer: move some initialization code from change_state to _init.
Set ->active to TRUE in _init so it can be set to FALSE after creating the
jitterbuffer and it won't be mistakenly reset to TRUE in the change_state
function.
This is needed to start the jitterbuffer as inactive when rtpbin is buffering.
2010-05-03 13:34:59 +02:00
Benjamin Otte cccfeaa59c gst_element_class_set_details => gst_element_class_set_details_simple 2010-03-18 14:32:00 +01:00
Sebastian Dröge bcd06ea527 rtpjitterbuffer: Reset skew detection after instantiating the jitterbuffer
...not only when going to READY. This sets high_level and friends to
a more useful value.
2010-02-23 17:24:03 +01:00
Tim-Philipp Müller 07fa73f199 docs: add Since: markers for new jitterbuffer properties 2010-02-19 12:13:07 +00:00
Wim Taymans 772eca5aff jitterbuffer: start out active and not buffering
There is no need to set the latency in the jittebuffer in _init, we will set
that later when going to PAUSED.
Set the jitterbuffer active and not buffering when starting.
2010-02-12 17:22:56 +01:00
Wim Taymans 8bbfd94c25 rtpbin: more buffering work
When deactivating jitterbuffers when the buffering starts, keep the current
percent of the jitterbuffer and also set the jitterbuffer in the buffering state
so that we know when it's filled again.
Add property to get the buffering percentage of the jitterbuffer.
2010-02-12 17:22:56 +01:00
Wim Taymans e6e287cdcc rtpjitterbuffer: adjust latency in buffer mode
When we are in buffer mode, adjust the buffering low/high thresholds based on
the total configured latency. If we don't and there is a huge queue or element
with a big latency downstream we might drain the complete queue immediately and
start buffering again.
2010-02-12 17:22:55 +01:00
Wim Taymans ab73603031 jitterbuffer: add ts-offset to timestamp
Add the ts-offset to the buffer timestamp to get the final output timestamp of
the buffer.
2010-02-12 17:22:55 +01:00
Wim Taymans 74a3be350d rtpbin: do more accurate buffer offsets
Return the next timestamp in the jitterbuffer.
Use the min-timestamp of the jitterbuffers to calculate an offset so that the
next timestamp is pushed with a timestamp equal to running_time.
Start producing timestamps from 0 in the buffering case too.
2010-02-12 17:22:55 +01:00
Wim Taymans ecf6ed8fc1 jitterbuffer: keep track of offset
Keep track of an outgoing offset that we add to each outgoing buffer to
compensate for PAUSE when buffering.
Adjust the offset when activating.
2010-02-12 17:22:54 +01:00
Wim Taymans 20a27a545a rtpbin: more buffering updates
Add signal to pause the jitterbuffer. This will be emitted from gstrtpbin when
one of the jitterbuffers is buffering.
Make rtpbin collect the buffering messages and post a new buffering message with
the min value.
Remove the stats callback from jitterbuffer but pass a percent integer to
functions that affect the buffering state of the jitterbuffer. This allows us
then to post buffering messages from outside of the jitterbuffer lock.
2010-02-12 17:22:53 +01:00
Wim Taymans a5b9d3f917 rtpbin: propagate buffer-mode property
Propagate buffer-mode property to the jitterbuffers.
Intercept BUFFERING messages in rtpbin
2010-02-12 17:22:53 +01:00
Wim Taymans d3db9574a9 jitterbuffer: do more buffering implementation
Add callback for buffering stats.
Configure the latency in the jitterbuffer instead of passing it with _insert.
Calculate buffering levels when pushing and popping
Post buffering messages.
2010-02-12 17:22:52 +01:00
Wim Taymans aeacbfed3e jitterbuffer: flesh out buffering mode some more
Add a buffering state to the jitterbuffer and wait until buffering ends before
pushing out packets.
2010-02-12 17:22:52 +01:00
Wim Taymans 56b29c9a6b jitterbuffer: hook up the mode property
Expose a mode property on the jitterbuffer.
Fix the case where timestamps are -1 in the check for outgoing timestamps.
2010-02-12 17:22:52 +01:00
Wim Taymans 99a581215f jitterbuffer: add some more debug info 2010-02-12 13:53:57 +01:00
Wim Taymans 8070ae967b jitterbuffer: avoid using wrong clock-rate
Check for a valid clock-rate before attempting to estimate the npt
stop time.
2009-11-25 10:38:23 -06:00
Wim Taymans f52859432f jitterbuffer: release lock before emiting signals
Release the jbuf lock before emiting the request-pt-map signal to avoid
deadlocks. We also need to catch the shutdown case when locking again.

Fixes #593354
2009-11-18 10:50:44 +01:00
Stefan Kost e43eb89449 tests: add a jitterbuffer test
Tests pushing a few buffers in various order and asserting the order sent by the
jitterbuffer. Contains two disabled tests that need more work.
2009-10-22 13:35:57 +03:00
Wim Taymans 8fb77403c5 jitterbuffer: cache latency in nanoseconds
Cache the latency in nanoseconds units to avoid having to convert the
milliseconds value to nanoseconds all the time.
2009-10-01 12:52:40 +02:00
Stefan Kost 0a7ef67ad0 docs: fix gtk-doc warnings 2009-09-10 10:28:48 +03:00
Håvard Graff 40549278c3 jitterbuffer: avoid throwing reordered buffers with same timestamps
When we receive a reordered packet with the same timestamp as the previous one
(which can happen for fragmented packets) don't consider the packet as lost but
instead wait for the reordered packet to arrive.

Switch the warning-level, so that a reordering does not get a warning, only
an actual produced lost-packet.

Fixes #594251
2009-09-08 13:39:31 +02:00
Olivier Crête f542f710cf rtpjitterbuffer: Lock clock_rate variable
The priv->clock_rate variable could become -1 between when its checked to not
be -1 and when its used, causing an assertion. Fixed by taking the mutex
earlier in the chain() function.

Fixes #593955
2009-09-03 19:17:00 +02:00
Wim Taymans 8d924611e7 jitterbuffer: make sure time does not go backwards
When we construct a timestamp that would result in a timestamp that is earlier
than when the packet was received, reset the skew calculation as this is
probably a sign that the sender restarted or paused.

Fixes #593354
2009-09-01 12:48:28 +02:00
Sebastian Dröge 000a483d31 rtp: Use new gst_iterator_new_single() for the internal linked pads iteration 2009-08-31 08:09:09 +02:00
Sebastian Dröge c8c02d2c7a jitterbuffer: Use iterate internal links instead of deprecated get internal links 2009-08-31 08:09:08 +02:00
Tim-Philipp Müller c5793a6a45 Make build without warnings with debugging disabled 2009-08-11 02:30:45 +01:00
Wim Taymans 64046416cc jitterbuffer: prevent overflow in EOS estimation
Use a guint64 instead of a guint to hold a 64bit value to prevent completely
bogues EOS estimation values due to overflows.
2009-08-11 02:30:41 +01:00
Wim Taymans 5ece6ae4e3 jitterbuffer: more estimated EOS fixes
Do more accurate EOS estimate and guard against backward timestamps.
2009-08-11 02:30:41 +01:00
Wim Taymans cbad89600c jitterbuffer: release lock before pushing EOS
Make sure we release the jitterbuffer lock before we start pushing out data
because else we might deadlock.
2009-08-11 02:30:41 +01:00
Wim Taymans 918c9448f2 rtpbin: add on_npt_stop signal
Add the on_npt_stop signal to rtpbin and rtpjitterbuffer to notify the
application that the NPT stop position has been reached.
2009-08-11 02:30:41 +01:00
Wim Taymans 7f0b100db5 Unlock the jitterbuffer before pushing out the packet-lost events.
Move some code before we do the unlock to make the jitterbuffer state
consistent while we are unlocked.
2009-08-11 02:30:40 +01:00
Sebastian Dröge e51423aab9 gst/rtpmanager/gstrtpjitterbuffer.c: Initialize return value to fix compiler warning about uninitialized variable.
Original commit message from CVS:
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_chain_rtcp):
Initialize return value to fix compiler warning about uninitialized
variable.
2009-08-11 02:30:39 +01:00
Wim Taymans d0ada6127e gst/rtpmanager/gstrtpjitterbuffer.c: Mark signal arg as static scope.
Original commit message from CVS:
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_class_init):
Mark signal arg as static scope.
2009-08-11 02:30:39 +01:00