Commit 0b315387 authored by Wim Taymans's avatar Wim Taymans

gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an...

gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...

Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
parent 43efcf42
2007-06-18 Wim Taymans <wim@fluendo.com>
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-17 Thomas Vander Stichele <thomas at apestaart dot org>
* po/uk.po:
......
This diff is collapsed.
......@@ -86,7 +86,7 @@ typedef struct _GstBinPrivate GstBinPrivate;
* @child_bus: internal bus for handling child messages
* @messages: queued and cached messages
* @polling: the bin is currently calculating its state
* @state_dirty: the bin needs to recalculate its state
* @state_dirty: the bin needs to recalculate its state (deprecated)
* @clock_dirty: the bin needs to select a new clock
* @provided_clock: the last clock selected
* @clock_provider: the element that provided @provided_clock
......
......@@ -1858,11 +1858,11 @@ gst_element_get_state_func (GstElement * element,
ret = GST_STATE_CHANGE_FAILURE;
}
}
}
/* if nothing is pending anymore we can return SUCCESS */
if (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING) {
GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "nothing pending");
ret = GST_STATE_CHANGE_SUCCESS;
/* if nothing is pending anymore we can return SUCCESS */
if (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING) {
GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "nothing pending");
ret = GST_STATE_CHANGE_SUCCESS;
}
}
done:
......@@ -1887,7 +1887,7 @@ interrupted:
if (pending)
*pending = GST_STATE_VOID_PENDING;
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "get_state() interruped");
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "interruped");
GST_OBJECT_UNLOCK (element);
......@@ -2100,8 +2100,13 @@ complete:
* We do signal the cond though as a _get_state() might be blocking
* on it. */
if (old_state != old_next || old_ret == GST_STATE_CHANGE_ASYNC) {
message = gst_message_new_state_changed (GST_OBJECT_CAST (element),
old_state, old_next, GST_STATE_VOID_PENDING);
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
"posting state-changed %s to %s",
gst_element_state_get_name (old_state),
gst_element_state_get_name (old_next));
message =
gst_message_new_state_changed (GST_OBJECT_CAST (element), old_state,
old_next, GST_STATE_VOID_PENDING);
gst_element_post_message (element, message);
}
......@@ -2891,7 +2896,8 @@ gst_element_set_bus (GstElement * element, GstBus * bus)
* gst_element_get_bus:
* @element: a #GstElement to get the bus of.
*
* Returns the bus of the element.
* Returns the bus of the element. Note that only a #GstPipeline will provide a
* bus for the application.
*
* Returns: the element's #GstBus. unref after usage.
*
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment