2005-03-28 14:54:33 +00:00
|
|
|
States
|
2010-11-01 13:32:43 +00:00
|
|
|
------
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
Both elements and pads can be in different states. The states of the pads are
|
|
|
|
linked to the state of the element so the design of the states is mainly
|
|
|
|
focused around the element states.
|
|
|
|
|
|
|
|
An element can be in 4 states. NULL, READY, PAUSED and PLAYING. When an element
|
|
|
|
is initially instantiated, it is in the NULL state.
|
|
|
|
|
|
|
|
|
|
|
|
State definitions
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
- NULL: This is the initial state of an element.
|
|
|
|
- READY: The element should be prepared to go to PAUSED.
|
|
|
|
- PAUSED: The element should be ready to accept and process data. Sink
|
|
|
|
elements however only accept one buffer and then block.
|
2007-09-24 11:22:26 +00:00
|
|
|
- PLAYING: The same as PAUSED except for live sources and sinks. Sinks accept
|
|
|
|
and rendering data. Live sources produce data.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
We call the sequence NULL->PLAYING an upwards state change and PLAYING->NULL
|
|
|
|
a downwards state change.
|
|
|
|
|
|
|
|
|
2005-10-08 16:49:15 +00:00
|
|
|
State transitions
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~
|
2005-10-08 16:49:15 +00:00
|
|
|
|
|
|
|
the following state changes are possible:
|
|
|
|
|
|
|
|
NULL -> READY
|
2006-12-21 15:00:08 +00:00
|
|
|
- The element must check if the resources it needs are available.
|
2009-12-14 13:11:14 +00:00
|
|
|
Device sinks and -sources typically try to probe the device to constrain
|
2006-12-21 15:00:08 +00:00
|
|
|
their caps.
|
2008-06-25 14:49:08 +00:00
|
|
|
- The element opens the device, this is needed if the previous step requires
|
|
|
|
the device to be opened.
|
2005-10-08 16:49:15 +00:00
|
|
|
|
|
|
|
READY -> PAUSED
|
2009-12-14 13:11:14 +00:00
|
|
|
- The element pads are activated in order to receive data in PAUSED.
|
2006-12-21 15:00:08 +00:00
|
|
|
Streaming threads are started.
|
2009-12-14 13:11:14 +00:00
|
|
|
- Some elements might need to return ASYNC and complete the state change
|
2005-10-08 16:49:15 +00:00
|
|
|
when they have enough information. It is a requirement for sinks to
|
|
|
|
return ASYNC and complete the state change when they receive the first
|
2009-12-14 13:11:14 +00:00
|
|
|
buffer or EOS event (preroll). Sinks also block the dataflow when in PAUSED.
|
|
|
|
- A pipeline resets the running_time to 0.
|
|
|
|
- Live sources return NO_PREROLL and don't generate data.
|
2005-10-08 16:49:15 +00:00
|
|
|
|
|
|
|
PAUSED -> PLAYING
|
2009-12-14 13:11:14 +00:00
|
|
|
- Most elements ignore this state change.
|
2005-10-08 16:49:15 +00:00
|
|
|
- The pipeline selects a clock and distributes this to all the children
|
2011-01-19 15:48:26 +00:00
|
|
|
before setting them to PLAYING. This means that it is only allowed to
|
2005-10-08 16:49:15 +00:00
|
|
|
synchronize on the clock in the PLAYING state.
|
2007-02-15 11:32:02 +00:00
|
|
|
- The pipeline uses the clock and the running_time to calculate the base_time.
|
|
|
|
The base_time is distributed to all children when performing the state
|
2005-10-08 16:49:15 +00:00
|
|
|
change.
|
2009-12-14 13:11:14 +00:00
|
|
|
- Sink elements stop blocking on the preroll buffer or event and start
|
|
|
|
rendering the data.
|
|
|
|
- Sinks can post the EOS message in the PLAYING state. It is not allowed to
|
2005-10-08 16:49:15 +00:00
|
|
|
post EOS when not in the PLAYING state.
|
2009-12-14 13:11:14 +00:00
|
|
|
- While streaming in PAUSED or PLAYING elements can create and remove
|
|
|
|
sometimes pads.
|
|
|
|
- Live sources start generating data and return SUCCESS.
|
2005-10-08 16:49:15 +00:00
|
|
|
|
|
|
|
PLAYING -> PAUSED
|
2009-12-14 13:11:14 +00:00
|
|
|
- Most elements ignore this state change.
|
2007-02-15 11:32:02 +00:00
|
|
|
- The pipeline calculates the running_time based on the last selected clock
|
|
|
|
and the base_time. It stores this information to continue playback when
|
2005-10-08 16:49:15 +00:00
|
|
|
going back to the PLAYING state.
|
2009-12-14 13:11:14 +00:00
|
|
|
- Sinks unblock any clock wait calls.
|
|
|
|
- When a sink does not have a pending buffer to play, it returns ASYNC from
|
|
|
|
this state change and completes the state change when it receives a new
|
|
|
|
buffer or an EOS event.
|
|
|
|
- Any queued EOS messages are removed since they will be reposted when going
|
2006-03-13 10:32:26 +00:00
|
|
|
back to the PLAYING state. The EOS messages are queued in GstBins.
|
2009-12-14 13:11:14 +00:00
|
|
|
- Live sources stop generating data and return NO_PREROLL.
|
2005-10-08 16:49:15 +00:00
|
|
|
|
|
|
|
PAUSED -> READY
|
2009-12-14 13:11:14 +00:00
|
|
|
- Sinks unblock any waits in the preroll.
|
|
|
|
- Elements unblock any waits on devices
|
|
|
|
- Chain or get_range functions return WRONG_STATE.
|
|
|
|
- The element pads are deactivated so that streaming becomes impossible and
|
|
|
|
all streaming threads are stopped.
|
|
|
|
- The sink forgets all negotiated formats
|
|
|
|
- Elements remove all sometimes pads
|
2005-10-08 16:49:15 +00:00
|
|
|
|
|
|
|
READY -> NULL
|
2009-12-14 13:11:14 +00:00
|
|
|
- Elements close devices
|
|
|
|
- Elements reset any internal state.
|
2005-10-08 16:49:15 +00:00
|
|
|
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
State variables
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-11-03 14:22:44 +00:00
|
|
|
An element has 4 state variables that are protected with the object LOCK:
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
- STATE
|
2005-10-08 16:49:15 +00:00
|
|
|
- STATE_NEXT
|
|
|
|
- STATE_PENDING
|
|
|
|
- STATE_RETURN
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-10-08 16:49:15 +00:00
|
|
|
The STATE always reflects the current state of the element.
|
|
|
|
The STATE_NEXT reflects the next state the element will go to.
|
|
|
|
The STATE_PENDING always reflects the required state of the element.
|
|
|
|
The STATE_RETURN reflects the last return value of a state change.
|
2005-06-30 09:33:45 +00:00
|
|
|
|
2005-10-08 16:49:15 +00:00
|
|
|
The STATE_NEXT and STATE_PENDING can be VOID_PENDING if the element is in
|
|
|
|
the right state.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-11-03 14:22:44 +00:00
|
|
|
An element has a special lock to protect against concurrent invocations of
|
|
|
|
_set_state(), called the STATE_LOCK.
|
|
|
|
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
Setting state on elements
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-01-19 15:48:26 +00:00
|
|
|
The state of an element can be changed with _element_set_state(). When changing
|
2005-03-28 14:54:33 +00:00
|
|
|
the state of an element all intermediate states will also be set on the element
|
|
|
|
until the final desired state is set.
|
|
|
|
|
|
|
|
The _set_state() function can return 3 possible values:
|
|
|
|
|
|
|
|
GST_STATE_FAILURE: The state change failed for some reason. The plugin should
|
|
|
|
have posted an error message on the bus with information.
|
|
|
|
|
|
|
|
GST_STATE_SUCCESS: The state change is completed successfully.
|
|
|
|
|
|
|
|
GST_STATE_ASYNC: The state change will complete later on. This can happen
|
2011-01-19 15:48:26 +00:00
|
|
|
when the element needs a long time to perform the state
|
2005-03-28 14:54:33 +00:00
|
|
|
change or for sinks that need to receive the first buffer
|
|
|
|
before they can complete the state change (preroll).
|
|
|
|
|
2005-06-23 10:37:09 +00:00
|
|
|
GST_STATE_NO_PREROLL: The state change is completed successfully but the element
|
|
|
|
will not be able to produce data in the PAUSED state.
|
|
|
|
|
2006-03-13 10:32:26 +00:00
|
|
|
In the case of an ASYNC state change, it is possible to proceed to the next
|
2005-10-08 16:49:15 +00:00
|
|
|
state before the current state change completed, however, the element will only
|
|
|
|
get to this next state before completing the previous ASYNC state change.
|
|
|
|
After receiving an ASYNC return value, you can use _element_get_state() to poll
|
|
|
|
the status of the element. If the polling returns SUCCESS, the element completed
|
|
|
|
the state change to the last requested state with _set_state().
|
|
|
|
|
|
|
|
When setting the state of an element, the STATE_PENDING is set to the required
|
|
|
|
state. Then the state change function of the element is called and the result of
|
|
|
|
that function is used to update the STATE and STATE_RETURN fields, STATE_NEXT,
|
|
|
|
STATE_PENDING and STATE_RETURN fields. If the function returned ASYNC, this result
|
2011-01-19 15:48:26 +00:00
|
|
|
is immediately returned to the caller.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
Getting state of elements
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
The _get_state() function takes 3 arguments, two pointers that will hold the
|
2005-10-12 12:58:55 +00:00
|
|
|
current and pending state and one GstClockTime that holds a timeout value. The
|
2005-03-28 14:54:33 +00:00
|
|
|
function returns a GstElementStateReturn.
|
|
|
|
|
|
|
|
- If the element returned SUCCESS to the previous _set_state() function, this
|
|
|
|
function will return the last state set on the element and VOID_PENDING in
|
2005-06-30 09:33:45 +00:00
|
|
|
the pending state value. The function returns GST_STATE_SUCCESS.
|
|
|
|
|
|
|
|
- If the element returned NO_PREROLL to the previous _set_state() function, this
|
|
|
|
function will return the last state set on the element and VOID_PENDING in
|
|
|
|
the pending state value. The function returns GST_STATE_NO_PREROLL.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
- If the element returned FAILURE to the previous _set_state() call, this
|
|
|
|
funciton will return FAILURE with the state set to the current state of
|
|
|
|
the element and the pending state set to the value used in the last call
|
|
|
|
of _set_state().
|
|
|
|
|
|
|
|
- If the element returned ASYNC to the previous _set_state() call, this function
|
|
|
|
will wait for the element to complete its state change up to the amount of time
|
2005-10-12 12:58:55 +00:00
|
|
|
specified in the GstClockTime.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
* If the element does not complete the state change in the specified amount of
|
|
|
|
time, this function will return ASYNC with the state set to the current state
|
|
|
|
and the pending state set to the pending state.
|
|
|
|
|
|
|
|
* If the element completes the state change within the specified timeout, this
|
|
|
|
function returns the updated state and VOID_PENDING as the pending state.
|
|
|
|
|
|
|
|
* If the element aborts the ASYNC state change due to an error within the
|
|
|
|
specified timeout, this function returns FAILURE with the state set to last
|
2011-09-07 11:14:38 +00:00
|
|
|
successful state and pending set to the last attempt. The element should
|
2005-03-28 14:54:33 +00:00
|
|
|
also post an error message on the bus with more information about the problem.
|
|
|
|
|
|
|
|
|
|
|
|
States in GstBin
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
A GstBin manages the state of its children. It does this by propagating the state
|
|
|
|
changes performed on it to all of its children. The _set_state() function on a
|
2009-08-18 09:38:38 +00:00
|
|
|
bin will call the _set_state() function on all of its children, that are
|
|
|
|
not already in the target state or in a change state to the target state.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
The children are iterated from the sink elements to the source elements. This makes
|
|
|
|
sure that when changing the state of an element, the downstream elements are in
|
|
|
|
the correct state to process the eventual buffers. In the case of a downwards
|
|
|
|
state change, the sink elements will shut down first which makes the upstream
|
|
|
|
elements shut down as well since the _push() function returns a GST_FLOW_WRONG_STATE
|
|
|
|
error.
|
|
|
|
|
|
|
|
If all the children return SUCCESS, the function returns SUCCESS as well.
|
|
|
|
|
|
|
|
If one of the children returns FAILURE, the function returns FAILURE as well. In
|
2011-09-07 11:14:38 +00:00
|
|
|
this state it is possible that some elements successfully changed state. The
|
2005-03-28 14:54:33 +00:00
|
|
|
application can check which elements have a changed state, which were in error
|
|
|
|
and which were not affected by iterating the elements and calling _get_state()
|
|
|
|
on the elements.
|
|
|
|
|
|
|
|
If after calling the state function on all children, one of the children returned
|
2007-02-15 11:32:02 +00:00
|
|
|
ASYNC, the function returns ASYNC as well.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-06-23 10:37:09 +00:00
|
|
|
If after calling the state function on all children, one of the children returned
|
|
|
|
NO_PREROLL, the function returns NO_PREROLL as well.
|
|
|
|
|
2006-03-13 10:32:26 +00:00
|
|
|
If both NO_PREROLL and ASYNC children are present, NO_PREROLL is returned.
|
|
|
|
|
2005-10-08 16:49:15 +00:00
|
|
|
The current state of the bin can be retrieved with _get_state().
|
2005-06-23 10:37:09 +00:00
|
|
|
|
2005-10-08 16:49:15 +00:00
|
|
|
If the bin is performing an ASYNC state change, it will automatically update its
|
|
|
|
current state fields when it receives state messages from the children.
|
2005-06-23 10:37:09 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
Implementing states in elements
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
READY
|
2010-11-01 13:32:43 +00:00
|
|
|
^^^^^
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-08 16:49:15 +00:00
|
|
|
upward state change
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~
|
2005-10-08 16:49:15 +00:00
|
|
|
|
|
|
|
Upward state changes always return ASYNC either if the STATE_PENDING is
|
|
|
|
reached or not.
|
|
|
|
|
|
|
|
Element:
|
|
|
|
|
|
|
|
A -> B => SUCCESS
|
|
|
|
- commit state
|
|
|
|
|
|
|
|
A -> B => ASYNC
|
|
|
|
- no commit state
|
|
|
|
- element commits state ASYNC
|
|
|
|
|
|
|
|
A -> B while ASYNC
|
|
|
|
- update STATE_PENDING state
|
|
|
|
- no commit state
|
|
|
|
- no change_state called on element
|
|
|
|
|
|
|
|
Bin:
|
|
|
|
|
|
|
|
A->B: all elements SUCCESS
|
|
|
|
- commit state
|
|
|
|
|
|
|
|
A->B: some elements ASYNC
|
|
|
|
- no commit state
|
|
|
|
- listen for commit messages on bus
|
2006-03-13 10:32:26 +00:00
|
|
|
- for each commit message, poll elements, this happens in another
|
|
|
|
thread.
|
2005-10-08 16:49:15 +00:00
|
|
|
- if no ASYNC elements, commit state, continue state change
|
|
|
|
to STATE_PENDING
|
|
|
|
|
|
|
|
downward state change
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~
|
2005-10-08 16:49:15 +00:00
|
|
|
|
|
|
|
Downward state changes only return ASYNC if the final state is ASYNC.
|
|
|
|
This is to make sure that it's not needed to wait for an element to
|
|
|
|
complete the preroll or other ASYNC state changes when one only wants to
|
|
|
|
shut down an element.
|
|
|
|
|
|
|
|
Element:
|
|
|
|
|
|
|
|
A -> B => SUCCESS
|
|
|
|
- commit state
|
|
|
|
|
|
|
|
A -> B => ASYNC not final state
|
|
|
|
- commit state on behalf of element
|
|
|
|
|
|
|
|
A -> B => ASYNC final state
|
|
|
|
- element will commit ASYNC
|
|
|
|
|
|
|
|
Bin:
|
|
|
|
|
|
|
|
A -> B -> SUCCESS
|
|
|
|
- commit state
|
|
|
|
|
|
|
|
A -> B -> ASYNC not final state
|
|
|
|
- commit state on behalf of element, continue state change
|
|
|
|
|
|
|
|
A -> B => ASYNC final state
|
|
|
|
- no commit state
|
|
|
|
- listen for commit messages on bus
|
|
|
|
- for each commit message, poll elements
|
|
|
|
- if no ASYNC elements, commit state
|
|
|
|
|
|
|
|
|
|
|
|
Locking overview (element)
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2005-10-08 16:49:15 +00:00
|
|
|
|
docs/design/part-states.txt: Some more docs.
Original commit message from CVS:
* docs/design/part-states.txt:
Some more docs.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_recalc_state),
(gst_bin_change_state_func), (bin_bus_handler):
Doc updates. Don't distribute the same clock over and over again.
* gst/gstclock.c:
* gst/gstclock.h:
Doc updates.
* gst/gstpad.c: (gst_flow_get_name), (gst_flow_to_quark),
(gst_pad_get_type), (gst_pad_push), (gst_pad_push_event),
(gst_pad_send_event):
* gst/gstpad.h:
Make probe emission threadsafe again.
Register quarks and move _get_name() from utils.
Doc updates.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
Only redistribute the clock of it changed.
* gst/gstsystemclock.h:
Doc updates.
* gst/gstutils.c:
* gst/gstutils.h:
Moved the _flow_get_name() to GstPad.
2005-10-11 11:08:52 +00:00
|
|
|
* Element commiting SUCCESS
|
|
|
|
|
|
|
|
- STATE_LOCK is taken in set_state
|
|
|
|
- change state is called if SUCCESS, commit state is called
|
|
|
|
- commit state calls change_state to next state change.
|
|
|
|
- if final state is reached, stack unwinds and result is returned to
|
|
|
|
set_state and caller.
|
|
|
|
|
|
|
|
|
|
|
|
set_state(element) change_state (element) commit_state
|
|
|
|
|
|
|
|
| | |
|
|
|
|
| | |
|
|
|
|
STATE_LOCK | |
|
|
|
|
| | |
|
|
|
|
|------------------------>| |
|
|
|
|
| | |
|
|
|
|
| | |
|
|
|
|
| | (do state change) |
|
|
|
|
| | |
|
|
|
|
| | |
|
|
|
|
| | if SUCCESS |
|
|
|
|
| |---------------------->|
|
|
|
|
| | | post message
|
|
|
|
| | |
|
|
|
|
| |<----------------------| if (!final) change_state (next)
|
|
|
|
| | | else SIGNAL
|
|
|
|
| | |
|
|
|
|
| | |
|
|
|
|
| | |
|
|
|
|
|<------------------------| |
|
|
|
|
| SUCCESS
|
|
|
|
|
|
|
|
|
STATE_UNLOCK
|
|
|
|
|
|
|
|
|
SUCCESS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Element commiting ASYNC
|
|
|
|
|
|
|
|
- STATE_LOCK is taken in set_state
|
|
|
|
- change state is called and returns ASYNC
|
|
|
|
- ASYNC returned to the caller.
|
2006-03-13 10:32:26 +00:00
|
|
|
- element takes LOCK in streaming thread.
|
docs/design/part-states.txt: Some more docs.
Original commit message from CVS:
* docs/design/part-states.txt:
Some more docs.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_recalc_state),
(gst_bin_change_state_func), (bin_bus_handler):
Doc updates. Don't distribute the same clock over and over again.
* gst/gstclock.c:
* gst/gstclock.h:
Doc updates.
* gst/gstpad.c: (gst_flow_get_name), (gst_flow_to_quark),
(gst_pad_get_type), (gst_pad_push), (gst_pad_push_event),
(gst_pad_send_event):
* gst/gstpad.h:
Make probe emission threadsafe again.
Register quarks and move _get_name() from utils.
Doc updates.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
Only redistribute the clock of it changed.
* gst/gstsystemclock.h:
Doc updates.
* gst/gstutils.c:
* gst/gstutils.h:
Moved the _flow_get_name() to GstPad.
2005-10-11 11:08:52 +00:00
|
|
|
- element calls commit_state in streaming thread.
|
|
|
|
- commit state calls change_state to next state change.
|
|
|
|
|
|
|
|
|
2005-10-08 16:49:15 +00:00
|
|
|
set_state(element) change_state (element) stream_thread commit_state (element)
|
|
|
|
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
STATE_LOCK | | |
|
|
|
|
| | | |
|
|
|
|
|------------------------>| | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | (start_task) | |
|
|
|
|
| | | |
|
|
|
|
| | STREAM_LOCK |
|
docs/design/part-states.txt: Some more docs.
Original commit message from CVS:
* docs/design/part-states.txt:
Some more docs.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_recalc_state),
(gst_bin_change_state_func), (bin_bus_handler):
Doc updates. Don't distribute the same clock over and over again.
* gst/gstclock.c:
* gst/gstclock.h:
Doc updates.
* gst/gstpad.c: (gst_flow_get_name), (gst_flow_to_quark),
(gst_pad_get_type), (gst_pad_push), (gst_pad_push_event),
(gst_pad_send_event):
* gst/gstpad.h:
Make probe emission threadsafe again.
Register quarks and move _get_name() from utils.
Doc updates.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
Only redistribute the clock of it changed.
* gst/gstsystemclock.h:
Doc updates.
* gst/gstutils.c:
* gst/gstutils.h:
Moved the _flow_get_name() to GstPad.
2005-10-11 11:08:52 +00:00
|
|
|
| | |... |
|
2005-10-08 16:49:15 +00:00
|
|
|
|<------------------------| | |
|
docs/design/part-states.txt: Some more docs.
Original commit message from CVS:
* docs/design/part-states.txt:
Some more docs.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_recalc_state),
(gst_bin_change_state_func), (bin_bus_handler):
Doc updates. Don't distribute the same clock over and over again.
* gst/gstclock.c:
* gst/gstclock.h:
Doc updates.
* gst/gstpad.c: (gst_flow_get_name), (gst_flow_to_quark),
(gst_pad_get_type), (gst_pad_push), (gst_pad_push_event),
(gst_pad_send_event):
* gst/gstpad.h:
Make probe emission threadsafe again.
Register quarks and move _get_name() from utils.
Doc updates.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
Only redistribute the clock of it changed.
* gst/gstsystemclock.h:
Doc updates.
* gst/gstutils.c:
* gst/gstutils.h:
Moved the _flow_get_name() to GstPad.
2005-10-11 11:08:52 +00:00
|
|
|
| ASYNC STREAM_UNLOCK |
|
2005-10-08 16:49:15 +00:00
|
|
|
STATE_UNLOCK | |
|
|
|
|
| .....sync........ STATE_LOCK |
|
|
|
|
ASYNC |----------------->|
|
|
|
|
| |
|
docs/design/part-states.txt: Some more docs.
Original commit message from CVS:
* docs/design/part-states.txt:
Some more docs.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_recalc_state),
(gst_bin_change_state_func), (bin_bus_handler):
Doc updates. Don't distribute the same clock over and over again.
* gst/gstclock.c:
* gst/gstclock.h:
Doc updates.
* gst/gstpad.c: (gst_flow_get_name), (gst_flow_to_quark),
(gst_pad_get_type), (gst_pad_push), (gst_pad_push_event),
(gst_pad_send_event):
* gst/gstpad.h:
Make probe emission threadsafe again.
Register quarks and move _get_name() from utils.
Doc updates.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
Only redistribute the clock of it changed.
* gst/gstsystemclock.h:
Doc updates.
* gst/gstutils.c:
* gst/gstutils.h:
Moved the _flow_get_name() to GstPad.
2005-10-11 11:08:52 +00:00
|
|
|
| |---> post_message()
|
2005-10-08 16:49:15 +00:00
|
|
|
| |---> if (!final) change_state (next)
|
|
|
|
| | else SIGNAL
|
|
|
|
|<-----------------|
|
|
|
|
STATE_UNLOCK
|
|
|
|
|
|
docs/design/part-states.txt: Some more docs.
Original commit message from CVS:
* docs/design/part-states.txt:
Some more docs.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_recalc_state),
(gst_bin_change_state_func), (bin_bus_handler):
Doc updates. Don't distribute the same clock over and over again.
* gst/gstclock.c:
* gst/gstclock.h:
Doc updates.
* gst/gstpad.c: (gst_flow_get_name), (gst_flow_to_quark),
(gst_pad_get_type), (gst_pad_push), (gst_pad_push_event),
(gst_pad_send_event):
* gst/gstpad.h:
Make probe emission threadsafe again.
Register quarks and move _get_name() from utils.
Doc updates.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
Only redistribute the clock of it changed.
* gst/gstsystemclock.h:
Doc updates.
* gst/gstutils.c:
* gst/gstutils.h:
Moved the _flow_get_name() to GstPad.
2005-10-11 11:08:52 +00:00
|
|
|
STREAM_LOCK
|
|
|
|
| ...
|
2005-10-08 16:49:15 +00:00
|
|
|
STREAM_UNLOCK
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
|
2010-11-01 13:32:43 +00:00
|
|
|
Remarks
|
|
|
|
~~~~~~~
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
|
|
|
|
set_state cannot be called from multiple threads at the same time. The STATE_LOCK
|
|
|
|
prevents this.
|
|
|
|
|
|
|
|
state variables are protected with the LOCK.
|
|
|
|
|
|
|
|
calling set_state while gst_state is called should unlock the get_state with
|
|
|
|
an error. The cookie will do that.
|
|
|
|
|
|
|
|
|
|
|
|
set_state(element)
|
|
|
|
|
|
|
|
STATE_LOCK
|
|
|
|
|
|
|
|
LOCK
|
|
|
|
update current, next, pending state
|
|
|
|
cookie++
|
|
|
|
UNLOCK
|
|
|
|
|
|
|
|
change_state
|
|
|
|
|
|
|
|
STATE_UNLOCK
|
|
|
|
|
2005-10-08 16:49:15 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
|