timedvaluecontrolsource: Check that the only iter is the end iter in the GSequence

Previous patch was assuming that if the returned iter was the last iter
the GSequence was empty, which is obviously wrong.
This commit is contained in:
Thibault Saunier 2015-05-16 12:57:12 +02:00
parent 78bbaeb6e7
commit 33924a7f04

View file

@ -182,8 +182,10 @@ gst_timed_value_control_source_set_internal (GstTimedValueControlSource *
iter =
g_sequence_search (self->values, &timestamp,
(GCompareDataFunc) gst_control_point_find, NULL);
if (iter && !g_sequence_iter_is_end (iter)) {
if (iter) {
GSequenceIter *prev = g_sequence_iter_prev (iter);
if (!g_sequence_iter_is_end (prev)) {
GstControlPoint *cp = g_sequence_get (prev);
/* If the timestamp is the same just update the control point value */
@ -199,6 +201,7 @@ gst_timed_value_control_source_set_internal (GstTimedValueControlSource *
goto done;
}
}
}
} else {
self->values = g_sequence_new ((GDestroyNotify) gst_control_point_free);
GST_INFO ("create new timed value sequence");