Commit graph

148 commits

Author SHA1 Message Date
Nirbheek Chauhan
46f857b314 aggregator: Clamp the min latency at the max if it's greater 2014-12-27 09:45:08 +01:00
Nirbheek Chauhan
3193094cbc aggregator: Print the sinkpad name while logging latency queries
Very useful while debugging.
2014-12-27 09:45:08 +01:00
Nirbheek Chauhan
f3efb9e7d6 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.
2014-12-27 09:45:08 +01:00
Sebastian Dröge
6771db209d aggregator: Don't leak flush-start events 2014-12-23 11:45:05 +01:00
Sebastian Dröge
e7867a3586 aggregator: Also change the default latency to 0, not just the minimum 2014-12-23 10:24:27 +01:00
Sebastian Dröge
c04bb6983e aggregator: Fix docs and default value of the latency property 2014-12-23 09:52:20 +01:00
Sebastian Dröge
800f0ac49b aggregator: Also include the subclass latency in the result of the latency query 2014-12-22 22:19:52 +01:00
Sebastian Dröge
5dd1dfdadc aggregator: Post a latency message if the value of the latency property changes 2014-12-22 15:27:25 +01:00
Sebastian Dröge
a27ff89d42 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.
2014-12-22 15:03:59 +01:00
Sebastian Dröge
341e5291c3 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.
2014-12-22 15:00:36 +01:00
Sebastian Dröge
06a4e80be9 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.
2014-12-17 19:51:32 +01:00
Sebastian Dröge
d4c4af699e 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.
2014-12-17 18:41:41 +01:00
Sebastian Dröge
852b08340e aggregator: Some minor cleanup 2014-12-16 17:33:01 +01:00
Matthew Waters
8bf53a1226 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
2014-12-16 16:58:57 +01:00
Sebastian Dröge
4ad6984662 aggregator: Unblock events/queries immediately if the pad is flushing
https://bugzilla.gnome.org/show_bug.cgi?id=740376
2014-11-19 17:17:44 +01:00
Sebastian Dröge
ce69180862 aggregator: Drop serialized events/queries if the pad is flushing
https://bugzilla.gnome.org/show_bug.cgi?id=740376
2014-11-19 17:17:44 +01:00
Sebastian Dröge
a31faecb8b 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
2014-11-19 17:06:52 +01:00
Sebastian Dröge
3e27c5592f aggregator: Fix typo in debug output 2014-11-19 17:04:45 +01:00
Matthew Waters
051955e5fa aggregator: add _get_latency() for subclass usage
API: gst_aggregator_get_latency

https://bugzilla.gnome.org/show_bug.cgi?id=739996
2014-11-17 22:39:07 +11:00
Vineeth T M
aec1f2a001 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
2014-10-21 10:58:48 +02:00
Matthew Waters
b9db635f48 aggregator: add latency query handling 2014-10-09 23:52:11 +11:00
Matthew Waters
a41bc98b6e 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.
2014-10-09 23:52:11 +11:00
Jan Alexander Steffens (heftig)
dce92c75b1 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
2014-10-06 18:57:28 +02:00
Mathieu Duponchelle
1d94b3f66a aggregator: Set seqnum only when segments are received. 2014-10-06 18:57:28 +02:00
Thibault Saunier
982b9dc3ea 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.
2014-10-06 18:57:28 +02:00
Thibault Saunier
65d20d1028 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
2014-10-06 18:57:28 +02:00
Mathieu Duponchelle
59b15e6659 aggregator: set future seqnum before propagating the seek event.
So the seqnum is properly set for the following events.
2014-10-06 18:57:28 +02:00
Thibault Saunier
d82dddc3e5 aggregator: Store segment when seeked in READY for later use 2014-10-06 18:57:28 +02:00
Sebastian Dröge
b3cd526347 aggregator: Unref the taglist in GstAggregator::stop() 2014-10-06 10:11:23 +03:00
Thibault Saunier
1b4547ff93 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
2014-10-03 13:18:05 +02:00
Matthew Waters
44e84025d7 aggregator: fix up doc comment for set_src_caps
It does not occur 'later' anymore

https://bugzilla.gnome.org/show_bug.cgi?id=732662
2014-08-11 23:38:40 +10:00
Matthew Waters
7c016752d7 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
2014-08-11 23:36:27 +10:00
Mathieu Duponchelle
d11af7cd6b aggregator: Reset flow_return *after* stopping the srcpad task.
Otherwise it might be set in an already running aggregate function.
2014-07-16 17:52:35 +02:00
Thibault Saunier
619237c0d0 aggregator: Flush sinkpads when stopping
All values are meaningless in that case, so we should make sure that
we clean everything
2014-07-16 17:52:35 +02:00
Thibault Saunier
d9385687fb 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.
2014-07-16 17:52:30 +02:00
Thibault Saunier
9233c6ac69 aggregator: Handle event seqnum 2014-07-16 17:05:25 +02:00
Sebastian Dröge
f701aa29b9 libs: Don't install headers and pc files for libgstwayland/badvideo/badbase
These will disappear after 1.4.0 and it would be rather annoying if
people started depending on them.

https://bugzilla.gnome.org/show_bug.cgi?id=732207
2014-07-11 09:33:57 +02:00
Tim-Philipp Müller
551122c19a aggregator: fix locking
We would unlock a mutex we never locked on SEGMENT
events.
2014-07-06 22:09:53 +01:00
Thibault Saunier
71c81a5176 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
2014-06-30 14:24:49 +02:00
Thiago Santos
bdda4bb689 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.
2014-06-28 09:44:22 -03:00
Thiago Santos
b0652ee88f aggregator: always unref the buffer on _finish function
Otherwise the user doesn't know if it was unref'd or not
2014-06-28 09:44:22 -03:00
Thiago Santos
5ce02fa5f9 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
2014-06-28 09:44:22 -03:00
Matthew Waters
a9215f78b5 aggregator: plug a memory leak of the srccaps 2014-06-26 10:53:16 +10:00
Sebastian Dröge
104816e906 badbase: Use the correct LDFLAGS for creating libraries
Otherwise we won't e.g. create .dlls on Windows
2014-06-24 11:27:15 +02:00
Thibault Saunier
816b12d100 libs:base: Properly declare APIs as UNSTABLE 2014-06-21 17:02:50 +02:00
Thibault Saunier
8250845b47 libs:base: Fix includedir 2014-06-21 15:26:14 +02:00
Thibault Saunier
6409641130 aggregator: Fix requested pad name 2014-06-21 14:14:26 +02:00
Thibault Saunier
55c65d079f 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
2014-06-20 19:53:33 +02:00