Event "state change" handling from element to element?
Marcos Kintschner
marcos.ktn at gmail.com
Sun Oct 21 11:01:41 UTC 2018
Hi,
Can you post more details about your pipeline?
You gotta remember that sink elements like AppSink will go from READY to
PAUSED only when they receive a buffer pushed by the source element.
For example, consider a simple pipeline like this: fakesrc ! queue !
fakesink. This is how the states are changed for each element when you set
the state of pipeline to PLAYING:
1. All elements, from the most downstream element (fakesink) to the most
upstream element (fakesrc), go from NULL to READY state:
fakesink: NULL -> READY
queue: NULL -> READY
fakesrc: NULL -> READY
pipeline: NULL -> READY
2. Now all elements *EXCEPT* the sink elements (fakesink in this case), will
go from READY to PAUSED. The sink element will stay in the READY state for
now (while the other elements returned GST_STATE_CHANGE_SUCCESS when
changing from READY to PAUSED, the sink will return GST_STATE_CHANGE_ASYNC,
because it will change its state later when it receives a buffer).
queue: creates its streaming thread
queue: READY -> PAUSED
fakesrc: creates its streaming thread
fakesrc: READY -> PAUSED
queue: enter its streaming thread
fakesrc: enter its streaming thread
3. Now fakesrc will start pushing buffers. Yes, in the PAUSED state. The
PAUSED state and PLAYING state are the "same thing" for non-sink elements.
When the sink, that still is the READY state, receives the first buffer, it
will block its sink pad and proceed to (finally) change its state to PAUSED.
fakesrc: push buffers
fakesink: receives first buffer then blocks
fakesink: READY -> PAUSED
pipeline: READY -> PAUSED
4. Now the pipeline is ready to go to the PLAYING state. The pipeline will
choose a clock from the most upstream element available and it each element
will change its state.
fakesink: unblocks its sink pad
fakesink: PAUSED -> PLAYING
queue: PAUSED -> PLAYING
fakesrc: PAUSED -> PLAYING
pipeline: PAUSED -> PLAYING
You can read more about states here:
https://gstreamer.freedesktop.org/documentation/design/states.html
There's also another case to consider when the source element is a live
element. In this case, the sink element will go from READY to PAUSED then to
PLAYING only when the pipeline is already in the PLAYING state, because it's
only in this state that live source can produce data (while non-live sources
can produce data in the PAUSED state).
You can read more about live sources here:
https://gstreamer.freedesktop.org/documentation/design/live-source.html
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list