platform/upstream/gstreamer.git
6 years agoaggregator: fix typo in test suite
Reynaldo H. Verdejo Pinochet [Fri, 27 Mar 2015 22:28:05 +0000 (19:28 -0300)]
aggregator: fix typo in test suite

6 years agoaggregator: add gap event handling unit test
Reynaldo H. Verdejo Pinochet [Fri, 27 Mar 2015 21:32:27 +0000 (18:32 -0300)]
aggregator: add gap event handling unit test

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

6 years agoaggregator: implement gap handling
Reynaldo H. Verdejo Pinochet [Wed, 18 Mar 2015 01:13:06 +0000 (22:13 -0300)]
aggregator: implement gap handling

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

6 years agoaggregator: Unify downstream flow return and flushing
Olivier Crête [Thu, 2 Apr 2015 02:10:11 +0000 (22:10 -0400)]
aggregator: Unify downstream flow return and flushing

Also means that having a non-OK downstream flow return
wakes up the chain functions.

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

6 years agoaggregator: Flushing is always in pad lock, no need to atomics
Olivier Crête [Thu, 2 Apr 2015 01:45:01 +0000 (21:45 -0400)]
aggregator: Flushing is always in pad lock, no need to atomics

The usage of atomics was always doubtful as it was used to release a
GCond

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

6 years agoaggregator: Reset pending_eos on pad flush
Olivier Crête [Thu, 2 Apr 2015 01:38:11 +0000 (21:38 -0400)]
aggregator: Reset pending_eos on pad flush

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

6 years agoaggregator: Unify code to set a pad flushing
Olivier Crête [Thu, 2 Apr 2015 01:37:25 +0000 (21:37 -0400)]
aggregator: Unify code to set a pad flushing

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

6 years agoaggregator: Query latency on first incoming buffer.
Olivier Crête [Sat, 7 Mar 2015 02:12:52 +0000 (21:12 -0500)]
aggregator: Query latency on first incoming buffer.

And keep on querying upstream until we get a reply.

Also, the _get_latency_unlocked() method required being calld
with a private lock, so removed the _unlocked() variant from the API.
And it now returns GST_CLOCK_TIME_NONE when the element is not live as
we think that 0 upstream latency is possible.

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

6 years agoaggregator: Be more aggressive with invalid replies to our latency query
Olivier Crête [Sat, 7 Mar 2015 02:12:13 +0000 (21:12 -0500)]
aggregator: Be more aggressive with invalid replies to our latency query

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

6 years agoaggregatory: don't redefine GST_FLOW_CUSTOM_SUCCESS
Matthew Waters [Sat, 7 Mar 2015 15:04:11 +0000 (02:04 +1100)]
aggregatory: don't redefine GST_FLOW_CUSTOM_SUCCESS

6 years agoaggregator: Use standard upstream latency querying logic
Arun Raghavan [Thu, 26 Feb 2015 18:56:00 +0000 (00:26 +0530)]
aggregator: Use standard upstream latency querying logic

The same functionality is duplicated in the default latency querying
now.

6 years agoaggregator: Use src_lock to protect latency related members
Olivier Crete [Fri, 20 Feb 2015 02:21:56 +0000 (21:21 -0500)]
aggregator: Use src_lock to protect latency related members

One has to use the src_lock anyway to protect the min/max/live so they
can be notified atomically to the src thread to wake it up on changes,
such as property changes. So no point in having a second lock.

Also, the object lock was being held across a call to
GST_ELEMENT_WARNING, guaranteeing a deadlock.

6 years agoaggregator: Remove untrue comment
Olivier Crête [Thu, 19 Feb 2015 23:53:32 +0000 (18:53 -0500)]
aggregator: Remove untrue comment

6 years agoaggregator: Don't try to push tags while flush seeking
Olivier Crête [Thu, 19 Feb 2015 23:30:35 +0000 (18:30 -0500)]
aggregator: Don't try to push tags while flush seeking

The downstream segment could have been flushed already, so
need to re-send the segment event before re-sending the tags.

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

6 years agoaggregator: Use the sinkpads iterator directly to query upstream latencies
Sebastian Dröge [Thu, 19 Feb 2015 09:04:28 +0000 (11:04 +0200)]
aggregator: Use the sinkpads iterator directly to query upstream latencies

While gst_aggregator_iterate_sinkpads() makes sure that every pad is only
visited once, even when the iterator has to resync, this is not all we have
to do for querying the latency. When the iterator resyncs we actually have
to query all pads for the latency again and forget our previous results. It
might have happened that a pad was removed, which influenced the result of
the latency query.

6 years agoaggregator: Move gst_aggregator_get_latency_unlocked() a bit
Sebastian Dröge [Thu, 19 Feb 2015 08:57:09 +0000 (10:57 +0200)]
aggregator: Move gst_aggregator_get_latency_unlocked() a bit

It was between another function and its helper function before, which was
confusing when reading the code as it had nothing to do with the other
functions.

6 years agoaggregator: Fail the latency query if one of the upstream queries fails
Sebastian Dröge [Wed, 18 Feb 2015 23:28:06 +0000 (01:28 +0200)]
aggregator: Fail the latency query if one of the upstream queries fails

6 years agoaggregator: Document locking order
Olivier Crête [Wed, 18 Feb 2015 20:53:53 +0000 (15:53 -0500)]
aggregator: Document locking order

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

6 years agoaggregator: Rename confusinly named SRC_STREAM_LOCK macros to SRC_LOCK
Olivier Crête [Wed, 18 Feb 2015 20:11:14 +0000 (15:11 -0500)]
aggregator: Rename confusinly named SRC_STREAM_LOCK macros to SRC_LOCK

This will match the name of the lock itself. It is also not a stream
lock as it not recursive and not held while pushing.

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

6 years agoaggregator: Rename confusingly named stream lock to flush lock
Olivier Crête [Wed, 18 Feb 2015 20:06:01 +0000 (15:06 -0500)]
aggregator: Rename confusingly named stream lock to flush lock

This lock is not what is commonly known as a "stream lock" in GStremer,
it's not recursive and it's taken from the non-serialized FLUSH_START event.

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

6 years agoaggregator: Fix macro indendation
Olivier Crête [Wed, 18 Feb 2015 20:04:04 +0000 (15:04 -0500)]
aggregator: Fix macro indendation

Changes no code

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

6 years agoaggregator: drop GAP events until we handle them properly
Tim-Philipp Müller [Fri, 13 Feb 2015 23:45:20 +0000 (23:45 +0000)]
aggregator: drop GAP events until we handle them properly

6 years agoaggregator: use new gst_aggregator_pad_drop_buffer()
Tim-Philipp Müller [Fri, 13 Feb 2015 15:53:19 +0000 (15:53 +0000)]
aggregator: use new gst_aggregator_pad_drop_buffer()

6 years agoaggregator: add gst_aggregator_pad_drop_buffer()
Tim-Philipp Müller [Fri, 13 Feb 2015 15:49:50 +0000 (15:49 +0000)]
aggregator: add gst_aggregator_pad_drop_buffer()

steal_buffer() + unref seems to be a wide-spread idiom
(which perhaps indicates that something is not quite
right with the way aggregator pad works currently).

6 years agoaggregator: only post latency message if anything changed
Tim-Philipp Müller [Thu, 12 Feb 2015 13:32:39 +0000 (13:32 +0000)]
aggregator: only post latency message if anything changed

Perhaps we should check for element state as well and
only post it if in PLAYING state.

6 years agoImprove and fix LATENCY query handling
Sebastian Dröge [Wed, 11 Feb 2015 13:16:21 +0000 (14:16 +0100)]
Improve and fix LATENCY query handling

This now follows the design docs everywhere, especially the maximum latency
handling.

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

6 years agoaggregator: Pause srcpad task on flow errors
Sebastian Dröge [Tue, 10 Feb 2015 09:49:16 +0000 (10:49 +0100)]
aggregator: Pause srcpad task on flow errors

Otherwise we will call the task function over and over again until
upstream finally handled the flow return and shuts us down.

6 years agoaggregator: Streamline latency calculations
Sebastian Dröge [Fri, 6 Feb 2015 09:59:27 +0000 (10:59 +0100)]
aggregator: Streamline latency calculations

Min latency can never be invalid, latency property can never be invalid
either. So no need to check for all these things in various places.

6 years agoaggregator: If upstream has no max latency but the subclass has, take the subclass...
Sebastian Dröge [Fri, 6 Feb 2015 09:36:28 +0000 (10:36 +0100)]
aggregator: If upstream has no max latency but the subclass has, take the subclass max latency

6 years agoaggregator: Fix min>max latency error check
Sebastian Dröge [Fri, 6 Feb 2015 09:33:59 +0000 (10:33 +0100)]
aggregator: Fix min>max latency error check

We have to include the upstream latency, our own latency and the subclass
latency in the calculations.

FIXME: This is still not entirely correct

6 years agoaggregator: Don't add the latency property to the max latency
Sebastian Dröge [Fri, 6 Feb 2015 09:30:59 +0000 (10:30 +0100)]
aggregator: Don't add the latency property to the max latency

It has no meaning for the max latency and is only used to increase the min
latency.

6 years agoaggregator: Cleanup locking around AggregatorPad flush related fields
Thibault Saunier [Mon, 26 Jan 2015 16:06:29 +0000 (17:06 +0100)]
aggregator: Cleanup locking around AggregatorPad flush related fields

And document the locking

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

6 years agoaggregator: keep chain functions as dumb as possible.
Mathieu Duponchelle [Mon, 26 Jan 2015 12:11:05 +0000 (13:11 +0100)]
aggregator: keep chain functions as dumb as possible.

+ A pad chain function has no business checking other pads,
  that's what the aggregate thread is for.

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

6 years agoaggregator: More fixes around locking when accessing protected private fields
Thibault Saunier [Mon, 26 Jan 2015 10:32:47 +0000 (11:32 +0100)]
aggregator: More fixes around locking when accessing protected private fields

In some more places we were accessing GstAggregator->segment
and GstAggregator->seqnum without holding the GST_OBJECT_LOCK

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

6 years agoaggregator: Make the PAD_LOCK private
Thibault Saunier [Mon, 26 Jan 2015 10:29:08 +0000 (11:29 +0100)]
aggregator: Make the PAD_LOCK private

Instead of using the GST_OBJECT_LOCK we should have
a dedicated mutex for the pad as it is also associated
with the mutex on the EVENT_MUTEX on which we wait
in the _chain function of the pad.

The GstAggregatorPad.segment is still protected with the
GST_OBJECT_LOCK.

Remove the gst_aggregator_pad_peak_unlocked method as it does not make
sense anymore with a private lock.

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

6 years agoaggregator: Hide GstAggregatorPad buffer and EOS fileds
Thibault Saunier [Mon, 26 Jan 2015 10:25:54 +0000 (11:25 +0100)]
aggregator: Hide GstAggregatorPad buffer and EOS fileds

And add a getter for the EOS.

The user should always use the various getters to access
those fields

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

6 years agoaggregator: Document locking of GstAggregatorPrivate members
Olivier Crête [Wed, 21 Jan 2015 23:41:43 +0000 (18:41 -0500)]
aggregator: Document locking of GstAggregatorPrivate members

Most of them are protected by the object lock, specify
which ones use a different lock.

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

6 years agoaggregator: Document how the segment is protected
Olivier Crête [Wed, 21 Jan 2015 23:47:09 +0000 (18:47 -0500)]
aggregator: Document how the segment is protected

Document that it can only be accessed with the object lock.

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

6 years agoaggregator: Protect all latency related members with the object lock
Olivier Crête [Thu, 22 Jan 2015 00:44:57 +0000 (19:44 -0500)]
aggregator: Protect all latency related members with the object lock

The locking was not consistent, now consistently use the object lock.

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

6 years agoaggregator: Document locking for gst_aggregator_get_latency_unlocked()
Olivier Crête [Thu, 22 Jan 2015 00:43:12 +0000 (19:43 -0500)]
aggregator: Document locking for gst_aggregator_get_latency_unlocked()

Renamed it to _unlocked() to make it clear.

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

6 years agoaggregator: Protect the srcpad caps negotiation with the stream lock
Olivier Crête [Thu, 22 Jan 2015 00:35:25 +0000 (19:35 -0500)]
aggregator: Protect the srcpad caps negotiation with the stream lock

Instead of adding another lock, use the srcpad stream lock, which is already
taken anyway to push out the new caps if needed.

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

6 years agoaggregator: Protect the tags with the object lock
Olivier Crête [Thu, 22 Jan 2015 00:33:18 +0000 (19:33 -0500)]
aggregator: Protect the tags with the object lock

The tags related variables were sometimes protected, sometimes not and
sometimes atomic. Put them all under the object lock.

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

6 years agoaggregator: Consistenly lock the flow_return state
Olivier Crête [Wed, 21 Jan 2015 23:53:20 +0000 (18:53 -0500)]
aggregator: Consistenly lock the flow_return state

Use the object's lock to protect it.

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

6 years agoaggregator: Consistently lock some members
Olivier Crête [Wed, 21 Jan 2015 23:45:36 +0000 (18:45 -0500)]
aggregator: Consistently lock some members

Some members sometimes used atomic access, sometimes where not locked at
all. Instead consistently use a mutex to protect them, also document
that.

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

6 years agoaggregator: Protect exported pad members with the pad's object lock
Olivier Crête [Wed, 14 Jan 2015 19:38:09 +0000 (14:38 -0500)]
aggregator: Protect exported pad members with the pad's object lock

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

6 years agoaggregator: Replace event lock with pad's object lock
Olivier Crête [Wed, 14 Jan 2015 19:35:15 +0000 (14:35 -0500)]
aggregator: Replace event lock with pad's object lock

Reduce the number of locks simplify code, what is protects
is exposed, but the lock was not.

Also means adding an _unlocked version of gst_aggregator_pad_steal_buffer().

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

6 years agoaggregator: Protect data with the same mutex as GCond
Olivier Crête [Sat, 10 Jan 2015 03:01:00 +0000 (22:01 -0500)]
aggregator: Protect data with the same mutex as GCond

Whenever a GCond is used, the safest paradigm is to protect
the variable which change is signalled by the GCond with the same
mutex that the GCond depends on.

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

6 years agoaggregator: Nitpick spacing/punctuation in debug logging
Nirbheek Chauhan [Wed, 14 Jan 2015 18:17:19 +0000 (23:47 +0530)]
aggregator: Nitpick spacing/punctuation in debug logging

6 years agoaggregator: Remove pointless atomic
Olivier Crête [Sat, 10 Jan 2015 02:51:40 +0000 (21:51 -0500)]
aggregator: Remove pointless atomic

It is only modified from the streaming thread

6 years agoaggregator: Fix query leak
Olivier Crête [Sat, 10 Jan 2015 02:30:36 +0000 (21:30 -0500)]
aggregator: Fix query leak

6 years agoaggregator: Print jitter from clock waiting in the debug logs
Sebastian Dröge [Fri, 9 Jan 2015 15:43:39 +0000 (16:43 +0100)]
aggregator: Print jitter from clock waiting in the debug logs

6 years agoaggregator: don't use iterator when setting flush pending on pads
Tim-Philipp Müller [Sun, 4 Jan 2015 17:15:37 +0000 (17:15 +0000)]
aggregator: don't use iterator when setting flush pending on pads

6 years agoaggregator: check if pads are ready more efficiently
Tim-Philipp Müller [Sun, 4 Jan 2015 16:57:05 +0000 (16:57 +0000)]
aggregator: check if pads are ready more efficiently

No need to use an iterator for this which creates a temporary
structure every time and also involves taking and releasing the
object lock many times in the course of iterating. Not to mention
all that GList handling in gst_aggregator_iterate_sinkpads().

6 years agoaggregator: name vfunc arguments consistently
Tim-Philipp Müller [Sun, 4 Jan 2015 12:59:19 +0000 (12:59 +0000)]
aggregator: name vfunc arguments consistently

6 years agoaggregator: add g-i transfer and scope annotations
Tim-Philipp Müller [Thu, 1 Jan 2015 15:46:00 +0000 (15:46 +0000)]
aggregator: add g-i transfer and scope annotations

6 years agoaggregator: register names of iterate_sinkpads functions with debug system
Tim-Philipp Müller [Thu, 1 Jan 2015 14:10:05 +0000 (14:10 +0000)]
aggregator: register names of iterate_sinkpads functions with debug system

6 years agoaggregator: reduce debug messages for taking/releasing logs to TRACE level
Tim-Philipp Müller [Thu, 1 Jan 2015 14:03:02 +0000 (14:03 +0000)]
aggregator: reduce debug messages for taking/releasing logs to TRACE level

Don't spam debug log with this stuff.

6 years agoaggregator: move property member into private structure
Tim-Philipp Müller [Wed, 31 Dec 2014 18:16:21 +0000 (18:16 +0000)]
aggregator: move property member into private structure

Our locking (or lack thereof) while accessing this also
looks generally quite dodgy.

6 years agoaggregator: remove empty dispose function
Tim-Philipp Müller [Wed, 31 Dec 2014 14:50:58 +0000 (14:50 +0000)]
aggregator: remove empty dispose function

6 years agoaggregator: give private functions namespace prefix
Tim-Philipp Müller [Tue, 30 Dec 2014 23:58:34 +0000 (23:58 +0000)]
aggregator: give private functions namespace prefix

Especially the GST_DEBUG_FUNCPTR ones.

6 years agoaggregator: fix up some docs comments in header
Tim-Philipp Müller [Wed, 31 Dec 2014 12:35:06 +0000 (12:35 +0000)]
aggregator: fix up some docs comments in header

6 years agoaggregator: remove now-unused system clock member
Tim-Philipp Müller [Tue, 30 Dec 2014 23:44:46 +0000 (23:44 +0000)]
aggregator: remove now-unused system clock member

6 years agoaggregator: make GstAggregatorPadForeachFunc take an GstAggregatorPad
Tim-Philipp Müller [Tue, 30 Dec 2014 19:22:01 +0000 (19:22 +0000)]
aggregator: make GstAggregatorPadForeachFunc take an GstAggregatorPad

6 years agoaggregator: bring start/stop vfunc semantics in line with other baseclasses
Tim-Philipp Müller [Tue, 30 Dec 2014 17:50:17 +0000 (17:50 +0000)]
aggregator: bring start/stop vfunc semantics in line with other baseclasses

Sub-class should not have to chain up to GstAggregator's start/stop
vfuncs, same as in GstBaseSrc, GstBaseSink, GstBaseTransform etc.

6 years agoaggregator: remove pointless GST_DEBUG_FUNCPTR
Tim-Philipp Müller [Sun, 28 Dec 2014 18:26:49 +0000 (18:26 +0000)]
aggregator: remove pointless GST_DEBUG_FUNCPTR

Not useful for GObject vfuncs.

6 years agoaggregator: remove duplicate pad parent_class variable
Tim-Philipp Müller [Sun, 28 Dec 2014 18:24:21 +0000 (18:24 +0000)]
aggregator: remove duplicate pad parent_class variable

G_DEFINE_TYPE already provides one, just need to use it.

6 years agoaggregator: add _CAST() variants for cast macros
Tim-Philipp Müller [Sun, 28 Dec 2014 18:22:57 +0000 (18:22 +0000)]
aggregator: add _CAST() variants for cast macros

6 years agoaggregator: make padding larger
Tim-Philipp Müller [Sun, 28 Dec 2014 01:13:33 +0000 (01:13 +0000)]
aggregator: make padding larger

Esp. the class structures, can't have enough
spare space for virtual functions.

6 years agoaggregator: Log to the pad instead of the element
Nirbheek Chauhan [Sat, 27 Dec 2014 10:45:41 +0000 (16:15 +0530)]
aggregator: Log to the pad instead of the element

More correct way of doing the same thing as before

6 years agoaggregator: Make sure that the minimum latencies are never GST_CLOCK_TIME_NONE
Sebastian Dröge [Sat, 27 Dec 2014 08:49:43 +0000 (09:49 +0100)]
aggregator: Make sure that the minimum latencies are never GST_CLOCK_TIME_NONE

6 years agoaggregator: Wait for the minimum latency, not the maximum
Sebastian Dröge [Sat, 27 Dec 2014 08:42:57 +0000 (09:42 +0100)]
aggregator: Wait for the minimum latency, not the maximum

The minimum latency is the latency we have to wait at least
to guarantee that all upstreams have produced data. The maximum
latency has no meaning like that and shouldn't be used for waiting.

6 years agoaggregator: Clamp the min latency at the max if it's greater
Nirbheek Chauhan [Fri, 26 Dec 2014 22:51:36 +0000 (04:21 +0530)]
aggregator: Clamp the min latency at the max if it's greater

6 years agoaggregator: Print the sinkpad name while logging latency queries
Nirbheek Chauhan [Fri, 26 Dec 2014 22:51:26 +0000 (04:21 +0530)]
aggregator: Print the sinkpad name while logging latency queries

Very useful while debugging.

6 years agoaggregator: Take the stream lock when iterating sink pads
Nirbheek Chauhan [Fri, 26 Dec 2014 22:49:52 +0000 (04:19 +0530)]
aggregator: Take the stream lock when iterating sink pads

When iterating sink pads to collect some data, we should take the stream lock so
we don't get stale data and possibly deadlock because of that. This fixes
a definitive deadlock in _wait_and_check() that manifests with high max
latencies in a live pipeline, and fixes other possible race conditions.

6 years agoaggregator: Don't leak flush-start events
Sebastian Dröge [Tue, 23 Dec 2014 10:45:05 +0000 (11:45 +0100)]
aggregator: Don't leak flush-start events

6 years agoaggregator: Also change the default latency to 0, not just the minimum
Sebastian Dröge [Tue, 23 Dec 2014 09:24:27 +0000 (10:24 +0100)]
aggregator: Also change the default latency to 0, not just the minimum

6 years agoaggregator: Fix docs and default value of the latency property
Sebastian Dröge [Tue, 23 Dec 2014 08:52:20 +0000 (09:52 +0100)]
aggregator: Fix docs and default value of the latency property

6 years agoaggregator: Also include the subclass latency in the result of the latency query
Sebastian Dröge [Mon, 22 Dec 2014 21:19:52 +0000 (22:19 +0100)]
aggregator: Also include the subclass latency in the result of the latency query

6 years agoaggregator: Post a latency message if the value of the latency property changes
Sebastian Dröge [Mon, 22 Dec 2014 14:26:37 +0000 (15:26 +0100)]
aggregator: Post a latency message if the value of the latency property changes

6 years agoaggregator: Wake up the src thread after handling a latency query
Sebastian Dröge [Mon, 22 Dec 2014 14:03:59 +0000 (15:03 +0100)]
aggregator: Wake up the src thread after handling a latency query

Due to changed latencies or changed live-ness we might have to
adjust if we wait on a deadline at all and how long.

6 years agoaggregator: Don't count the number of times we need to wake up but instead check...
Sebastian Dröge [Mon, 22 Dec 2014 14:00:36 +0000 (15:00 +0100)]
aggregator: Don't count the number of times we need to wake up but instead check all conditions for waiting again

This simplifies the code and also makes sure that we don't forget to check all
conditions for waiting.

Also fix a potential deadlock caused by not checking if we're actually still
running before starting to wait.

6 years agoaggregator: Add function to allow subclasses to set their own latency
Sebastian Dröge [Wed, 17 Dec 2014 18:51:32 +0000 (19:51 +0100)]
aggregator: Add function to allow subclasses to set their own latency

For audiomixer this is one blocksize, for videoaggregator this should
be the duration of one output frame.

6 years agoaggregator: Add a timeout parameter to ::aggregate()
Sebastian Dröge [Wed, 17 Dec 2014 16:54:09 +0000 (17:54 +0100)]
aggregator: Add a timeout parameter to ::aggregate()

When this is TRUE, we really have to produce output. This happens
in live mixing mode when we have to output something for the current
time, no matter if we have enough input or not.

6 years agotests: fix aggregator unit test after property renaming
Tim-Philipp Müller [Tue, 16 Dec 2014 19:49:35 +0000 (19:49 +0000)]
tests: fix aggregator unit test after property renaming

6 years agoaggregator: Some minor cleanup
Sebastian Dröge [Tue, 16 Dec 2014 16:33:01 +0000 (17:33 +0100)]
aggregator: Some minor cleanup

6 years agoaggregator: make the src pad task drive the pipeline for live pipelines
Matthew Waters [Fri, 5 Dec 2014 07:19:54 +0000 (18:19 +1100)]
aggregator: make the src pad task drive the pipeline for live pipelines

This removes the uses of GAsyncQueue and replaces it with explicit
GMutex, GCond and wakeup count which is used for the non-live case.

For live pipelines, the aggregator waits on the clock until either
data arrives on all sink pads or the expected output buffer time
arrives plus the timeout/latency at which time, the subclass
produces a buffer.

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

6 years agotests/aggregator: Use correct type when setting property
Sebastian Rasmussen [Sun, 14 Dec 2014 00:29:26 +0000 (01:29 +0100)]
tests/aggregator: Use correct type when setting property

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

6 years agoaggregator: Unblock events/queries immediately if the pad is flushing
Sebastian Dröge [Wed, 19 Nov 2014 16:17:06 +0000 (17:17 +0100)]
aggregator: Unblock events/queries immediately if the pad is flushing

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

6 years agoaggregator: Drop serialized events/queries if the pad is flushing
Sebastian Dröge [Wed, 19 Nov 2014 16:15:02 +0000 (17:15 +0100)]
aggregator: Drop serialized events/queries if the pad is flushing

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

6 years agoaggregator: Block serialized events/queries until the pad has consumed all buffers
Sebastian Dröge [Wed, 19 Nov 2014 16:03:41 +0000 (17:03 +0100)]
aggregator: Block serialized events/queries until the pad has consumed all buffers

Otherwise the caps of the pad might change while the subclass still works with
a buffer of the old caps, assuming the the current pad caps apply to that
buffer. Which then leads to crashes and other nice effects.

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

6 years agoaggregator: Fix typo in debug output
Sebastian Dröge [Wed, 19 Nov 2014 16:03:33 +0000 (17:03 +0100)]
aggregator: Fix typo in debug output

6 years agoaggregator: add _get_latency() for subclass usage
Matthew Waters [Mon, 17 Nov 2014 03:00:10 +0000 (14:00 +1100)]
aggregator: add _get_latency() for subclass usage

API: gst_aggregator_get_latency

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

6 years agoaudiomixer: critical error for blocksize, timeout min/max values
Vineeth T M [Mon, 20 Oct 2014 12:55:08 +0000 (18:25 +0530)]
audiomixer: critical error for blocksize, timeout min/max values

Audiomixer blocksize, cant be 0, hence adjusting the minimum value to 1
timeout value of aggregator is defined with MAX of MAXINT64,
but it cannot cross G_MAXLONG * GST_SECOND - 1
Hence changed the max value of the same

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

6 years agotests/aggregator: add timeout handling test for the timeout parameter
Matthew Waters [Tue, 7 Oct 2014 05:57:27 +0000 (16:57 +1100)]
tests/aggregator: add timeout handling test for the timeout parameter

6 years agoaggregator: add latency query handling
Matthew Waters [Mon, 6 Oct 2014 10:46:24 +0000 (21:46 +1100)]
aggregator: add latency query handling

6 years agoaggregator: add a timeout property determining buffer wait time
Matthew Waters [Mon, 6 Oct 2014 07:23:03 +0000 (18:23 +1100)]
aggregator: add a timeout property determining buffer wait time

Determines the amount of time that a pad will wait for a buffer before
being marked unresponsive.

Network sources may fail to produce buffers for an extended period of time,
currently causing the pipeline to stall possibly indefinitely, waiting for
these buffers to appear.

Subclasses should render unresponsive pads with either silence (audio), the
last (video) frame or what makes the most sense in the given context.

6 years agoaggregator: Replace GMainContext with GAsyncQueue (v2)
Jan Alexander Steffens (heftig) [Wed, 17 Sep 2014 14:48:02 +0000 (16:48 +0200)]
aggregator: Replace GMainContext with GAsyncQueue (v2)

The previous implementation kept accumulating GSources,
slowing down the iteration and leaking memory.

Instead of trying to fix the main context flushing, replace
it with a GAsyncQueue which is simple to flush and has
less overhead.

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

6 years agoaggregator: Set seqnum only when segments are received.
Mathieu Duponchelle [Tue, 5 Aug 2014 13:36:30 +0000 (15:36 +0200)]
aggregator: Set seqnum only when segments are received.

6 years agoaggregator: Add a streaming lock so to secure flush start action
Thibault Saunier [Sat, 2 Aug 2014 16:25:01 +0000 (18:25 +0200)]
aggregator: Add a streaming lock so to secure flush start action

Without a lock that is taken in FLUSH_START we had a rare race where we
end up aggregating a buffer that was before the whole FLUSH_START/STOP
dance. That could lead to very wrong behaviour in subclasses.

6 years agoaggregator: Query seeking when a seek failed to see if it was expected
Thibault Saunier [Fri, 18 Jul 2014 11:58:55 +0000 (13:58 +0200)]
aggregator: Query seeking when a seek failed to see if it was expected

And do not worry if seeking failed on a stream that is not seekable