Note in the docs that a flushing step in PLAYING brings the pipeline to the lost
state and skips the data before prerolling again.
Implement the flushing step correctly by invalidating the current step
operation, which would activate the new step operation.
When the pipeline was stepping while the event is sent, the current step
operation is updated with the new amount and format. The sink will do a
best effort to comply with the new amount.
When the pipeline was stepping while the event is sent, the current step
operation is updated with the new amount and format. The sink will do a
best effort to comply with the new amount.
- - In the PLAYING state, the requested amount of data is skipped (not
- rendered) from the previous STEP request or from the position of the
- last PAUSED if no previous STEP operation was performed.
+ - In the PLAYING state, the pipeline loses the PLAYING state, the
+ requested amount of data is skipped (not rendered) from the previous STEP
+ request or from the position of the last PAUSED if no previous STEP
+ operation was performed. The pipeline goes back to the PLAYING state
+ when a non-intermediate step completes.
When flushing is FALSE, the step will be performed later.
When flushing is FALSE, the step will be performed later.
GstStepInfo * pending, GstStepInfo * current)
{
GST_DEBUG_OBJECT (sink, "update pending step");
GstStepInfo * pending, GstStepInfo * current)
{
GST_DEBUG_OBJECT (sink, "update pending step");
+
+ GST_OBJECT_LOCK (sink);
memcpy (current, pending, sizeof (GstStepInfo));
pending->valid = FALSE;
memcpy (current, pending, sizeof (GstStepInfo));
pending->valid = FALSE;
+ GST_OBJECT_UNLOCK (sink);
/* get the running time of where we paused and remember it */
current->start = gst_element_get_start_time (GST_ELEMENT_CAST (sink));
/* get the running time of where we paused and remember it */
current->start = gst_element_get_start_time (GST_ELEMENT_CAST (sink));
-set_step_info (GstBaseSink * sink, GstStepInfo * info, guint seqnum,
- GstFormat format, guint64 amount, gdouble rate, gboolean flush,
- gboolean intermediate)
+set_step_info (GstBaseSink * sink, GstStepInfo * current, GstStepInfo * pending,
+ guint seqnum, GstFormat format, guint64 amount, gdouble rate,
+ gboolean flush, gboolean intermediate)
{
GST_OBJECT_LOCK (sink);
{
GST_OBJECT_LOCK (sink);
- info->seqnum = seqnum;
- info->format = format;
- info->amount = amount;
- info->position = 0;
- info->rate = rate;
- info->flush = flush;
- info->intermediate = intermediate;
- info->valid = TRUE;
+ pending->seqnum = seqnum;
+ pending->format = format;
+ pending->amount = amount;
+ pending->position = 0;
+ pending->rate = rate;
+ pending->flush = flush;
+ pending->intermediate = intermediate;
+ pending->valid = TRUE;
+ /* flush invalidates the current stepping segment */
+ if (flush)
+ current->valid = FALSE;
GST_OBJECT_UNLOCK (sink);
}
GST_OBJECT_UNLOCK (sink);
}
GstFormat format;
guint64 amount;
guint seqnum;
GstFormat format;
guint64 amount;
guint seqnum;
+ GstStepInfo *pending, *current;
bclass = GST_BASE_SINK_GET_CLASS (sink);
priv = sink->priv;
bclass = GST_BASE_SINK_GET_CLASS (sink);
priv = sink->priv;
seqnum = gst_event_get_seqnum (event);
pending = &priv->pending_step;
seqnum = gst_event_get_seqnum (event);
pending = &priv->pending_step;
+ current = &priv->current_step;
if (flush) {
/* we need to call ::unlock before locking PREROLL_LOCK
if (flush) {
/* we need to call ::unlock before locking PREROLL_LOCK
bclass->unlock_stop (sink);
/* update the stepinfo and make it valid */
bclass->unlock_stop (sink);
/* update the stepinfo and make it valid */
- set_step_info (sink, pending, seqnum, format, amount, rate, flush,
+ set_step_info (sink, current, pending, seqnum, format, amount, rate, flush,
intermediate);
if (sink->priv->async_enabled) {
intermediate);
if (sink->priv->async_enabled) {
GST_PAD_PREROLL_UNLOCK (sink->sinkpad);
} else {
/* update the stepinfo and make it valid */
GST_PAD_PREROLL_UNLOCK (sink->sinkpad);
} else {
/* update the stepinfo and make it valid */
- set_step_info (sink, pending, seqnum, format, amount, rate, flush,
+ set_step_info (sink, current, pending, seqnum, format, amount, rate, flush,