Reynaldo H. Verdejo Pinochet
53cb334281
aggregator: fix typo in test suite
2017-12-02 15:10:26 +00:00
Reynaldo H. Verdejo Pinochet
1bd000fb2b
aggregator: add gap event handling unit test
...
https://bugzilla.gnome.org/show_bug.cgi?id=746249
2017-12-02 15:10:26 +00:00
Reynaldo H. Verdejo Pinochet
c955254758
aggregator: implement gap handling
...
https://bugzilla.gnome.org/show_bug.cgi?id=746249
2017-12-02 15:10:26 +00:00
Olivier Crête
e73a173224
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
2017-12-02 15:10:26 +00:00
Olivier Crête
30eb13a16d
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
2017-12-02 15:10:26 +00:00
Olivier Crête
c55b6be463
aggregator: Reset pending_eos on pad flush
...
https://bugzilla.gnome.org/show_bug.cgi?id=747220
2017-12-02 15:10:26 +00:00
Olivier Crête
d88e064019
aggregator: Unify code to set a pad flushing
...
https://bugzilla.gnome.org/show_bug.cgi?id=747220
2017-12-02 15:10:26 +00:00
Olivier Crête
5a0e2c4c47
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
2017-12-02 15:10:26 +00:00
Olivier Crête
46e33e84fd
aggregator: Be more aggressive with invalid replies to our latency query
...
https://bugzilla.gnome.org/show_bug.cgi?id=745768
2017-12-02 15:10:26 +00:00
Matthew Waters
87b25fb7a5
aggregatory: don't redefine GST_FLOW_CUSTOM_SUCCESS
2017-12-02 15:10:26 +00:00
Arun Raghavan
b7155695f8
aggregator: Use standard upstream latency querying logic
...
The same functionality is duplicated in the default latency querying
now.
2017-12-02 15:10:26 +00:00
Olivier Crete
5ac166a5d9
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.
2017-12-02 15:10:26 +00:00
Olivier Crête
77698267db
aggregator: Remove untrue comment
2017-12-02 15:10:26 +00:00
Olivier Crête
8f8430ee9e
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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
83203e9dc4
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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
075cfd8d7b
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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
2b932dc551
aggregator: Fail the latency query if one of the upstream queries fails
2017-12-02 15:10:26 +00:00
Olivier Crête
a42c4740ec
aggregator: Document locking order
...
https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
ad2cd52bae
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
2017-12-02 15:10:26 +00:00
Olivier Crête
3c17c777ee
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
2017-12-02 15:10:26 +00:00
Olivier Crête
aa78cf96f4
aggregator: Fix macro indendation
...
Changes no code
https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
e1aba92514
aggregator: drop GAP events until we handle them properly
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
1fe5f9db71
aggregator: use new gst_aggregator_pad_drop_buffer()
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
950b772a0d
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).
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller
4e97321898
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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
d97d363b1f
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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
1609e1d696
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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
9213f24716
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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
07d9bf9cab
aggregator: If upstream has no max latency but the subclass has, take the subclass max latency
2017-12-02 15:10:26 +00:00
Sebastian Dröge
e57b62be72
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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
87a2fbab60
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.
2017-12-02 15:10:26 +00:00
Thibault Saunier
24abac9fce
aggregator: Cleanup locking around AggregatorPad flush related fields
...
And document the locking
https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Mathieu Duponchelle
14f35e8a78
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
2017-12-02 15:10:26 +00:00
Thibault Saunier
97eab82ddf
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
2017-12-02 15:10:26 +00:00
Thibault Saunier
ae12041f0c
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
2017-12-02 15:10:26 +00:00
Thibault Saunier
5f176b724b
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
2017-12-02 15:10:26 +00:00
Olivier Crête
0588222925
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
2017-12-02 15:10:26 +00:00
Olivier Crête
fd326639ea
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
2017-12-02 15:10:26 +00:00
Olivier Crête
be58999bff
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
2017-12-02 15:10:26 +00:00
Olivier Crête
1d5f3fe084
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
2017-12-02 15:10:26 +00:00
Olivier Crête
142073cc79
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
2017-12-02 15:10:26 +00:00
Olivier Crête
9add348012
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
2017-12-02 15:10:26 +00:00
Olivier Crête
25faafaf58
aggregator: Consistenly lock the flow_return state
...
Use the object's lock to protect it.
https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
90f3cb4af0
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
2017-12-02 15:10:26 +00:00
Olivier Crête
2b7d4e2404
aggregator: Protect exported pad members with the pad's object lock
...
https://bugzilla.gnome.org/show_bug.cgi?id=742684
2017-12-02 15:10:26 +00:00
Olivier Crête
3217e82791
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
2017-12-02 15:10:26 +00:00
Olivier Crête
6379433a70
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
2017-12-02 15:10:26 +00:00
Nirbheek Chauhan
d33e6a191e
aggregator: Nitpick spacing/punctuation in debug logging
2017-12-02 15:10:26 +00:00
Olivier Crête
ec5ff5f308
aggregator: Remove pointless atomic
...
It is only modified from the streaming thread
2017-12-02 15:10:26 +00:00
Olivier Crête
53dd0c650f
aggregator: Fix query leak
2017-12-02 15:10:26 +00:00