Commit graph

24 commits

Author SHA1 Message Date
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
Matthew Waters 87b25fb7a5 aggregatory: don't redefine GST_FLOW_CUSTOM_SUCCESS 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
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 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 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 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
Tim-Philipp Müller 100d860ad2 aggregator: name vfunc arguments consistently 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller c5e3fe807a aggregator: move property member into private structure
Our locking (or lack thereof) while accessing this also
looks generally quite dodgy.
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller 71ec8e2879 aggregator: give private functions namespace prefix
Especially the GST_DEBUG_FUNCPTR ones.
2017-12-02 15:10:26 +00:00
Tim-Philipp Müller 3793bb8ad9 aggregator: fix up some docs comments in header 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller 7302a42ac1 aggregator: remove now-unused system clock member 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller 9f417fb08e aggregator: make GstAggregatorPadForeachFunc take an GstAggregatorPad 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller 85171e3512 aggregator: add _CAST() variants for cast macros 2017-12-02 15:10:26 +00:00
Tim-Philipp Müller 5350d8c653 aggregator: make padding larger
Esp. the class structures, can't have enough
spare space for virtual functions.
2017-12-02 15:10:26 +00:00
Sebastian Dröge b1dcc7efb0 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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge 435a477f63 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.
2017-12-02 15:10:26 +00:00
Matthew Waters f4b86a6d8c 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
2017-12-02 15:10:26 +00:00
Matthew Waters 4bdbb7a98f aggregator: add _get_latency() for subclass usage
API: gst_aggregator_get_latency

https://bugzilla.gnome.org/show_bug.cgi?id=739996
2017-12-02 15:10:26 +00:00
Matthew Waters efdcc6c8eb 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.
2017-12-02 15:10:26 +00:00
Thibault Saunier eace37b743 libs:base: Properly declare APIs as UNSTABLE 2017-12-02 15:10:25 +00:00
Thibault Saunier ae91ee2c98 aggregator: Add new GstAggregator base class
This base class has been added to a newly created libgstbadbase library

Co-Authored by: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>

https://bugzilla.gnome.org/show_bug.cgi?id=731917
2017-12-02 15:10:23 +00:00