Commit graph

550 commits

Author SHA1 Message Date
Edward Hervey
d02e1d7f7d bin: Fix iterator resync'ing
When we get GST_ITERATOR_RESYNC, we need to call gst_iterator_resync()
otherwise we will always get GST_ITERATOR_RESYNC (and that loop would
run forever).
2016-10-08 17:23:08 +02:00
Sebastian Dröge
bf1c12342a bin: Add forgotten "git commit --amend" for last commit
Need to cast away the const as g_queue_foreach() takes a non-const GQueue*
2016-09-19 10:07:51 -04:00
Kouhei Sutou
a43de49d52 bin: When copying the sort iterator, also copy its internal queue
Otherwise both iterators share the same references, the second one
usually resulting in a crash when being freed.

https://bugzilla.gnome.org/show_bug.cgi?id=771649
2016-09-19 10:04:55 -04:00
Sebastian Dröge
c7e0299d24 bin: Also don't *unset* element flags if they're in the suppressed flags
Otherwise our bin might lose various flags that were explicitly set on
it at arbitrary times.
2016-09-12 17:07:09 +02:00
Wonchul Lee
978b7ace52 bin: Add setter and getter to suppress element flags
Suppress-flags is for preventing propagation of child element's specific
flag when it is added to the bin.

https://bugzilla.gnome.org/show_bug.cgi?id=770627
2016-09-10 13:28:21 -03:00
Guillaume Desmottes
757a8b04c0 bin: properly display the type of the removed message
Makes debugging easier.

https://bugzilla.gnome.org/show_bug.cgi?id=768579
2016-07-08 17:52:40 +01:00
Tim-Philipp Müller
ef1444cfe4 bin: emit deep-element-{added,removed} for children of newly-added/removed bin
https://bugzilla.gnome.org/show_bug.cgi?id=578933
2016-05-16 09:10:09 +01:00
Tim-Philipp Müller
81dec8cc4d bin: add "deep-element-added" and "deep-element-removed" signals
This means applications and bin sub-classes can easily track when
a new child element is added to the pipeline sub-hierarchy or
removed.

Currently doesn't signal deep added/removed for elements inside
a bin if a bin is added/removed.

https://bugzilla.gnome.org/show_bug.cgi?id=578933
2016-05-16 09:10:09 +01:00
Jan Schmidt
174a5e93e2 bin: Fix EOS forwarding on PLAYING->PLAYING
When doing a transition from PLAYING to PLAYING, we will fail
to forward an EOS message on the bus, and noone else will ever
send it because there'll be no actual state changed message.

Allow EOS through directly in that case.
2016-05-14 23:46:47 +10:00
Sebastian Dröge
8177173db0 element: Add gst_element_call_async()
This calls a function from another thread, asynchronously. This is to be
used for cases when a state change has to be performed from a streaming
thread, directly via gst_element_set_state() or indirectly e.g. via SEEK
events.

Calling those functions directly from the streaming thread will cause
deadlocks in many situations, as they might involve waiting for the
streaming thread to shut down from this very streaming thread.

This is mostly a convenience function around a GThreadPool and is for example
used by GstBin to continue asynchronous state changes.

https://bugzilla.gnome.org/show_bug.cgi?id=760532
2016-04-27 18:51:33 +03:00
Mark Combellack
b8f2929dac GST_REFCOUNTING: Add logging of pointer address for dispose, finalize, etc messages
Updated the GST_REFCOUNTING logging so that it includes the pointer
address of the object that is being disposed or finalized.

With this change is is then possible to match up GST_REFCOUNTING log messages
for object allocation/disposal/finalization. This can help with diagnosing
"memory leaks" in applications that have not correctly disposed of all the
GStreamer objects it creates.

https://bugzilla.gnome.org/show_bug.cgi?id=749427
2016-04-02 18:18:10 +01:00
Sebastian Dröge
2d427c75ae bin: Post a LATENCY message with async-handling=TRUE if the PLAYING state is reached
Otherwise each bin might have a different latency in the end, causing
synchronization problems.

The bin will still first handle latency internally as before, but gives the
overall pipeline the opportunity to update the latency of the whole pipeline
afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=759125
2015-12-09 11:13:22 +02:00
Sebastian Dröge
2955eeb0ed bin: Make sure to free all cached messages when going to NULL
An ASYNC READY->PAUSED might have failed without the bin code noticing during
the state change, in which case we will never get PAUSED->READY and would leak
messages.

https://bugzilla.gnome.org/show_bug.cgi?id=756611
2015-10-19 11:06:54 +03:00
Marcin Kolny
e8d0b019b3 tracer: add missing hooks
Add following hooks: element-new, element-add-pad, element-remove-pad,
bin-add-pre, bin-add-post, bin-remove-pre, bin-remove-post, pad-link-pre,
pad-link-post, pad-unlink-pre, pad-unlink-post.

https://bugzilla.gnome.org/show_bug.cgi?id=733187
2015-10-05 20:59:39 +02:00
Matthew Waters
d5ded15889 bin: implement context propagation when adding elements
When adding an element to a bin we need to propagate the GstContext's
to/from the element.

This moves the GstContext list from GstBin to GstElement and adds
convenience functions to get the currently set list of GstContext's.

This does not deal with the collection of GstContext's propagated
using GST_CONTEXT_QUERY.  Element subclasses are advised to call
gst_element_set_context if they need to propagate GstContext's
received from the context query.

https://bugzilla.gnome.org/show_bug.cgi?id=705579
2015-09-28 18:21:59 +10:00
Stian Selnes
0fbf1d3eb7 bin: element: Ignore activate result for removed pads on state change
This fixes a race where a state change may return failure if it has
request pads that are deactivated and removed (and thus have no
parent) at the same time as the element changes state and (de)activates
its pads.

https://bugzilla.gnome.org/show_bug.cgi?id=755342
2015-09-24 12:14:57 +02:00
Vineeth TM
09900bbfb1 bin: fix typo in log message when threadpool alloc fails
https://bugzilla.gnome.org/show_bug.cgi?id=754975
2015-09-14 16:03:51 +01:00
Vivia Nikolaidou
ee1bbe2f15 bin: Make sure we don't add/remove a bin to/from itself
Doing so would deadlock from trying to acquire the object lock twice

https://bugzilla.gnome.org/show_bug.cgi?id=754036
2015-08-25 10:19:44 +03:00
Vincent Penquerc'h
a3b42ec42a bin: undo upward state changes on children when a child fails
When a bin changes states upwards, and a child fails to change,
any child that was already switched will not be reset to its
original state, leaving its state inconsistent with the bin,
which does not change state due to the failure.

If the state change was from NULL to READY, it means that deleting
this bin will cause those children to be deleted while not in
NULL state, which is a Bad Thing. For other upward changes, it
is less of a problem, as a subsequent switch back to NULL will
cause an actual downwards change on those inconsistent elements,
albeit from the "wrong" state.

We now reset state to the original one when a child fails.

Includes unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=747610
2015-04-15 16:00:21 +01:00
Sebastian Dröge
5b2c79eda7 bin: Pass structs we plan to modify around by pointer, not value
Otherwise the struct is going to be copied, which is not very efficient. And
also has the nice side effect that modifications of the struct might be
done in a copy, and we later use the original struct without the changes.

Caused LATENCY queries to always return the initialization values in one of my
tests, instead of the actual values reported by child elements.
2015-01-16 19:17:31 +01:00
Sebastian Dröge
154eefecc9 Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.

Also normalize booleans in a few places.
2014-12-01 09:51:37 +01:00
Sebastian Dröge
2f33fd5c19 bin: Use allow-none instead of nullable until we depend on a new enough GI version 2014-08-13 12:40:37 +03:00
Sebastian Dröge
9b96d4c7cd bin: gst_bin_new() can accept NULL as name 2014-08-13 12:39:47 +03:00
Evan Nemerson
2759882379 introspection: add missing (nullable) annotations to return values
Support for (nullable) was added to G-I at the same time as nullable
return values.  Previous versions of G-I will not mark return values as
nullable, even when an (allow-none) annotation is present, so it is
not necessary to add (allow-none) annotations for compatibility with
older versions of G-I.

https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 18:56:38 +02:00
Evan Nemerson
e10266e3f3 docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
This should help improve documentation generated for
languages other than C.

https://bugzilla.gnome.org/show_bug.cgi?id=730961
2014-05-30 00:20:27 +01:00
Sebastian Dröge
d2e431e0ff bin: Always first post the state-changed message for PAUSED->READY before posting any pending EOS message
https://bugzilla.gnome.org/show_bug.cgi?id=727949
2014-05-01 20:11:04 +02:00
Tim-Philipp Müller
6eb6d9ec38 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 21:21:51 +01:00
Sebastian Dröge
b76d336549 bin: When going to READY make sure to always deactivate pads
We might not have reached PAUSED yet because of an async error,
but nonetheless we want to make sure that the pads are always
deactivated in READY state.
2014-04-25 15:38:39 +02:00
Sebastian Dröge
ce8752c5ce bin: Don't left-shift into the sign bit, the result is undefined 2014-04-22 18:23:15 +02:00
Jan Schmidt
44f0be4ee6 gstbin: Avoid pointless object lock forwarding messages.
Every instance of calling bin_do_message_forward() first took the
object lock, so that bin_do_message_forward() could drop it and
then reclaim. Instead, only take the object lock afterward where
needed.
2014-03-17 05:36:37 +11:00
Sebastian Rasmussen
53ae1b2c9c docs: Fix typos in function/object descriptions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:11:12 +00:00
Sebastian Dröge
38f368e48e bin: Resync iterator if necessary 2013-11-15 07:32:48 +01:00
Sebastian Dröge
ccfca8f66f bin: Make sure to cache context types that we did not store yet
https://bugzilla.gnome.org/show_bug.cgi?id=708668
2013-09-24 12:46:52 +02:00
Sebastian Dröge
640a05ff60 bin: Implement context caching and propagation again 2013-09-18 21:42:42 +02:00
Sebastian Dröge
014690326f element: Remove GstContext caching 2013-09-17 13:16:40 +02:00
Sebastian Dröge
7c936a4cc2 bin: Use the new group-id field of the stream-start message for stream-start message aggregation
If all stream-start messages had a group id (for backwards compatibility),
we only consider a stream started if all had the same group id.

In 2.0 we should make the group id mandatory.
2013-07-22 15:30:10 +02:00
Sebastian Dröge
ba4ec10aa5 bin: Always forward clock-lost message if we're not a top-level bin
This makes sure that no bin misses the clock-lost messages, independent
of the state, and could return an old, non-working clock from
gst_bin_provide_clock_func().

https://bugzilla.gnome.org/show_bug.cgi?id=701997
2013-07-10 15:57:34 +02:00
Sebastian Dröge
dd831b8114 element: Add API to get the last set context from an element
Elements should override GstElement::set_context() and also call
gst_element_set_context() to keep this context up-to-date with
the very latest context they internally use.
2013-03-31 11:26:32 +02:00
Sebastian Dröge
b909061031 gst: Add new GstContext miniobject for sharing contexts in a pipeline 2013-03-29 16:40:21 +01:00
Wim Taymans
d7f15f542a use GST_MESSAGE_DURATION_CHANGED in docs and code 2013-02-26 15:32:25 +01:00
Sebastian Dröge
e479d22040 bin: The latency query should return TRUE by default, different to other queries
Fixes unit test failures caused by f3d268de7f
2013-02-13 11:19:06 +01:00
Philippe Normand
f3d268de7f bin: query sink elements and source pads of the bin
gst_bin_query() now forwards the query to the source pads as well if
none of the sinks of the bin satisfied the query. This helps in the
case of DURATION queries done a bin containing a source element.

Fixes bug 638749
2013-02-12 10:33:40 +01:00
Alexander Schrab
983fb0f5da bin: Let gst_bin_send_event() send events to ghost pads as well 2013-02-12 10:22:53 +01:00
Wim Taymans
ed35f62458 bin: remove old comment
The iterators now return a GValue and not the object directly anymore.
2013-02-07 12:52:26 +01:00
Wim Taymans
209631789a bin: reset GValue from iterator after usage 2013-02-07 12:50:08 +01:00
Wim Taymans
b163c09104 bin: add flag to disable resync state change
Add a GST_BIN_FLAG_NO_RESYNC that disables a resync when an element is added,
removed or linked in the bin. This is interesting for complex bins that
dynamically add elements to themselves and want to manage the state of those
elements without interference from resyncs.

See https://bugzilla.gnome.org/show_bug.cgi?id=690420
2012-12-21 16:36:37 +01:00
Wim Taymans
b7e7c9108a bin: remove some casts 2012-11-30 10:41:36 +01:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Tim-Philipp Müller
28604c197b bin, pipeline: use gst_element_class_set_static_metadata()
So the strings aren't copied.
2012-10-17 16:49:19 +01:00
Tim-Philipp Müller
f712a9596c message: rename GST_MESSAGE_DURATION -> GST_MESSAGE_DURATION_CHANGED
The duration should be re-queried via a query using the
normal path, we don't want applications to use the value
from the message itself, since it might no match what a
duration query done from the sink upstream might yield.

Also disables duration caching in GstBin. It should be
added back again at some point.
2012-09-02 01:18:58 +01:00