2005-03-28 14:54:33 +00:00
|
|
|
Preroll
|
|
|
|
-------
|
|
|
|
|
|
|
|
A sink element can only complete the state change to PAUSED after a buffer
|
|
|
|
has been queued on the input pad or pads. This process is called prerolling
|
|
|
|
and is needed to fill the pipeline with buffers so that the transition to
|
|
|
|
PLAYING goes as fast as possible with no visual delay for the user.
|
|
|
|
|
2011-01-19 15:48:26 +00:00
|
|
|
Preroll is also crucial in maintaining correct audio and video synchronisation
|
2005-06-02 08:26:58 +00:00
|
|
|
and ensuring that no buffers are dropped in the sinks.
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
After receiving a buffer (or EOS) on a pad the chain/event function should
|
|
|
|
wait to render the buffers or in the EOS case, wait to post the EOS
|
2007-09-24 11:22:26 +00:00
|
|
|
message. While waiting, the sink will wait for the preroll cond to be signalled.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2007-09-24 11:22:26 +00:00
|
|
|
Several things can happen that require the preroll cond to be signalled. This
|
2006-03-13 10:32:26 +00:00
|
|
|
include state changes or flush events. The prerolling is implemented in
|
|
|
|
sinks (see part-element-sink.txt)
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
Committing the state
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
When going to PAUSED and PLAYING a buffer should be queued in the pad. We also
|
|
|
|
make this requirement for going to PLAYING since a flush event in the PAUSED
|
|
|
|
state could unqueue the buffer again.
|
|
|
|
|
|
|
|
The state is commited in the following conditions:
|
|
|
|
|
|
|
|
- a buffer is received on a sinkpad
|
2012-10-08 07:11:53 +00:00
|
|
|
- an GAP event is received on a sinkpad.
|
|
|
|
- an EOS event is received on a sinkpad.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
We require the state change to be commited in EOS as well since an EOS means
|
|
|
|
by definition that no buffer is going to arrive anymore.
|
|
|
|
|
2005-06-30 09:33:45 +00:00
|
|
|
After the state is commited, a blocking wait should be performed for the
|
|
|
|
next event. Some sinks might render the preroll buffer before starting this
|
|
|
|
blocking wait.
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
Unlocking the preroll
|
2010-11-01 13:32:43 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
The following conditions unlock the preroll:
|
|
|
|
|
|
|
|
- a state change
|
|
|
|
- a flush event
|
2005-06-02 08:26:58 +00:00
|
|
|
|
2005-06-30 09:33:45 +00:00
|
|
|
When the preroll is unlocked by a flush event, a return value of
|
2012-05-11 07:07:16 +00:00
|
|
|
GST_FLOW_FLUSHING is to be returned to the peer pad.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-06-30 09:33:45 +00:00
|
|
|
When preroll is unlocked by a state change to PLAYING, playback and
|
|
|
|
rendering of the buffers shall start.
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-06-30 09:33:45 +00:00
|
|
|
When preroll is unlocked by a state change to READY, the buffer is
|
2012-05-11 07:07:16 +00:00
|
|
|
to be discarded and a GST_FLOW_FLUSHING shall be returned to the
|
2005-06-30 09:33:45 +00:00
|
|
|
peer element.
|
2005-03-28 14:54:33 +00:00
|
|
|
|