validate-scenario: Properly get the rate for action validation

This issue was most likely introduced by the refactoring of the
position querying into a standalone function.

In execute_next_action() the rate variable was never replaced by
the current rate of the pipeline, this would result in all reverse
playback actions to trigger immediately instead of waiting for
the actual target time.

https://bugzilla.gnome.org/show_bug.cgi?id=776280
This commit is contained in:
Edward Hervey 2016-12-19 16:17:56 +01:00
parent e42d9a784e
commit 5eab79dbd3

View file

@ -1352,10 +1352,9 @@ _get_position (GstValidateScenario * scenario,
static gboolean
_check_position (GstValidateScenario * scenario, GstValidateAction * act,
GstClockTime * position)
GstClockTime * position, gdouble * rate)
{
GstQuery *query;
gdouble rate;
GstClockTime start_with_tolerance, stop_with_tolerance;
GstValidateScenarioPrivate *priv = scenario->priv;
@ -1393,15 +1392,15 @@ _check_position (GstValidateScenario * scenario, GstValidateAction * act,
query = gst_query_new_segment (GST_FORMAT_DEFAULT);
if (gst_element_query (GST_ELEMENT (scenario->pipeline), query))
gst_query_parse_segment (query, &rate, NULL, NULL, NULL);
gst_query_parse_segment (query, rate, NULL, NULL, NULL);
gst_query_unref (query);
if (priv->seeked_in_pause && priv->seek_flags & GST_SEEK_FLAG_ACCURATE) {
if ((rate > 0 && (*position >= priv->segment_start + priv->seek_pos_tol ||
if ((*rate > 0 && (*position >= priv->segment_start + priv->seek_pos_tol ||
*position < ((priv->segment_start <
priv->seek_pos_tol) ? 0 : priv->segment_start -
priv->seek_pos_tol)))
|| (rate < 0 && (*position > priv->segment_start + priv->seek_pos_tol
|| (*rate < 0 && (*position > priv->segment_start + priv->seek_pos_tol
|| *position < ((priv->segment_start <
priv->seek_pos_tol) ? 0 : priv->segment_start -
priv->seek_pos_tol)))) {
@ -1782,7 +1781,7 @@ execute_next_action (GstValidateScenario * scenario)
}
}
if (!_check_position (scenario, act, &position))
if (!_check_position (scenario, act, &position, &rate))
return G_SOURCE_CONTINUE;
if (!_should_execute_action (scenario, act, position, rate)) {