Commit graph

39 commits

Author SHA1 Message Date
Sebastian Dröge
4c477549d2 aggregator: Also include the subclass latency in the result of the latency query 2017-12-02 15:10:26 +00:00
Sebastian Dröge
5caf89da37 aggregator: Post a latency message if the value of the latency property changes 2017-12-02 15:10:26 +00:00
Sebastian Dröge
7240852e55 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.
2017-12-02 15:10:26 +00:00
Sebastian Dröge
a20863a7ec 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.
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
Sebastian Dröge
bf5652f84a aggregator: Some minor cleanup 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
Sebastian Dröge
47d0efacf2 aggregator: Unblock events/queries immediately if the pad is flushing
https://bugzilla.gnome.org/show_bug.cgi?id=740376
2017-12-02 15:10:26 +00:00
Sebastian Dröge
f3c741e74e aggregator: Drop serialized events/queries if the pad is flushing
https://bugzilla.gnome.org/show_bug.cgi?id=740376
2017-12-02 15:10:26 +00:00
Sebastian Dröge
0ad159dfb4 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
2017-12-02 15:10:26 +00:00
Sebastian Dröge
e3b42c8acb aggregator: Fix typo in debug output 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
Vineeth T M
376de6cef3 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
2017-12-02 15:10:26 +00:00
Matthew Waters
3c8198e99f aggregator: add latency query handling 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
Jan Alexander Steffens (heftig)
e8c34afd5f 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
2017-12-02 15:10:26 +00:00
Mathieu Duponchelle
aaff6b50f8 aggregator: Set seqnum only when segments are received. 2017-12-02 15:10:26 +00:00
Thibault Saunier
1efd6b2edd 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.
2017-12-02 15:10:25 +00:00
Thibault Saunier
d5a3056ef2 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
2017-12-02 15:10:25 +00:00
Mathieu Duponchelle
f6adb43916 aggregator: set future seqnum before propagating the seek event.
So the seqnum is properly set for the following events.
2017-12-02 15:10:25 +00:00
Thibault Saunier
eb1d322962 aggregator: Store segment when seeked in READY for later use 2017-12-02 15:10:25 +00:00
Sebastian Dröge
034e74b216 aggregator: Unref the taglist in GstAggregator::stop() 2017-12-02 15:10:25 +00:00
Thibault Saunier
cc14d18e08 aggregator: Take lock to ensure set_caps is not called concurently
Avoiding to be in an inconsistent state where we do not have
actual negotiate caps set as srccaps and leading to point where we
try to unref ->srccaps when they have already been set to NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=735042
2017-12-02 15:10:25 +00:00
Matthew Waters
1a0b4f88c2 aggregator: fix up doc comment for set_src_caps
It does not occur 'later' anymore

https://bugzilla.gnome.org/show_bug.cgi?id=732662
2017-12-02 15:10:25 +00:00
Matthew Waters
42e2933133 videoaggregator: push the caps event as soon as we receive it
Along with the required mandatory dependent events.

Some elements need to perform an allocation query inside
::negotiated_caps().  Without the caps event being sent prior,
downstream elements will be unable to answer and will return
an error.

https://bugzilla.gnome.org/show_bug.cgi?id=732662
2017-12-02 15:10:25 +00:00
Mathieu Duponchelle
5ef53b8a29 aggregator: Reset flow_return *after* stopping the srcpad task.
Otherwise it might be set in an already running aggregate function.
2017-12-02 15:10:25 +00:00
Thibault Saunier
e3075ed3ef aggregator: Flush sinkpads when stopping
All values are meaningless in that case, so we should make sure that
we clean everything
2017-12-02 15:10:25 +00:00
Thibault Saunier
7e5d9daf8e aggregator: Do not forget to reset the flow return when stoping
Setting it to FLUSHING when the element is not started, and to OK
when it starts.
2017-12-02 15:10:25 +00:00
Thibault Saunier
9a88538eca aggregator: Handle event seqnum 2017-12-02 15:10:25 +00:00
Tim-Philipp Müller
3a49e1c311 aggregator: fix locking
We would unlock a mutex we never locked on SEGMENT
events.
2017-12-02 15:10:25 +00:00
Thibault Saunier
481476c439 aggregator: Avoid destroying sources we do not own
+ Unref the maincontext in a new dispose function
+ Make sure to remove all sources on dispose

https://bugzilla.gnome.org/show_bug.cgi?id=732445
2017-12-02 15:10:25 +00:00
Thiago Santos
259a73a3dc aggregator: always store or unref the buffer on the _chain function
Otherwise it leaks, and it is very common to go to flushing when the
pipeline is stopping, leaking a buffer.
2017-12-02 15:10:25 +00:00
Thiago Santos
109f7c937b aggregator: always unref the buffer on _finish function
Otherwise the user doesn't know if it was unref'd or not
2017-12-02 15:10:25 +00:00
Thiago Santos
5f1b50fce4 aggregator: add dispose/finalize functions
Add functions to be able to cleanup the mutex/cond and pending buffers
on the aggregator and on its pad
2017-12-02 15:10:25 +00:00
Matthew Waters
19c8fcfa28 aggregator: plug a memory leak of the srccaps 2017-12-02 15:10:25 +00:00
Thibault Saunier
eace37b743 libs:base: Properly declare APIs as UNSTABLE 2017-12-02 15:10:25 +00:00
Thibault Saunier
bd03141055 aggregator: Fix requested pad name 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