queue, queue2, multiqueue: Timestamps of gap events must be valid

This is checked in gst_event_new_gap() so doesn't have to be checked again here,
but simply can be asserted with a g_return_if_fail().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7071>
This commit is contained in:
Sebastian Dröge 2024-06-20 15:13:27 +03:00
parent 909cd6d865
commit 8117ee4fa3
3 changed files with 63 additions and 63 deletions

View file

@ -1880,36 +1880,36 @@ apply_gap (GstMultiQueue * mq, GstSingleQueue * sq, GstEvent * event,
GstClockTime duration;
gboolean is_sink = segment == &sq->sink_segment;
GST_MULTI_QUEUE_MUTEX_LOCK (mq);
gst_event_parse_gap (event, &timestamp, &duration);
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
if (is_sink && !GST_CLOCK_STIME_IS_VALID (sq->sink_start_time)) {
sq->sink_start_time = my_segment_to_running_time (segment, timestamp);
GST_DEBUG_ID (sq->debug_id, "Start time updated to %" GST_STIME_FORMAT,
GST_STIME_ARGS (sq->sink_start_time));
}
g_return_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp));
if (GST_CLOCK_TIME_IS_VALID (duration)) {
timestamp += duration;
}
GST_MULTI_QUEUE_MUTEX_LOCK (mq);
GST_DEBUG_ID (sq->debug_id,
"%s position updated to %" GST_TIME_FORMAT,
is_sink ? "sink" : "src", GST_TIME_ARGS (timestamp));
segment->position = timestamp;
if (is_sink)
sq->sink_tainted = TRUE;
else
sq->src_tainted = TRUE;
/* calc diff with other end */
update_time_level (mq, sq);
if (is_sink && !GST_CLOCK_STIME_IS_VALID (sq->sink_start_time)) {
sq->sink_start_time = my_segment_to_running_time (segment, timestamp);
GST_DEBUG_ID (sq->debug_id, "Start time updated to %" GST_STIME_FORMAT,
GST_STIME_ARGS (sq->sink_start_time));
}
if (GST_CLOCK_TIME_IS_VALID (duration)) {
timestamp += duration;
}
GST_DEBUG_ID (sq->debug_id,
"%s position updated to %" GST_TIME_FORMAT,
is_sink ? "sink" : "src", GST_TIME_ARGS (timestamp));
segment->position = timestamp;
if (is_sink)
sq->sink_tainted = TRUE;
else
sq->src_tainted = TRUE;
/* calc diff with other end */
update_time_level (mq, sq);
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
gst_multi_queue_post_buffering (mq);
}

View file

@ -608,27 +608,27 @@ apply_gap (GstQueue * queue, GstEvent * event,
gst_event_parse_gap (event, &timestamp, &duration);
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
if (is_sink && !GST_CLOCK_STIME_IS_VALID (queue->sink_start_time)) {
queue->sink_start_time = my_segment_to_running_time (segment, timestamp);
GST_DEBUG_OBJECT (queue, "Start time updated to %" GST_STIME_FORMAT,
GST_STIME_ARGS (queue->sink_start_time));
}
g_return_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp));
if (GST_CLOCK_TIME_IS_VALID (duration)) {
timestamp += duration;
}
segment->position = timestamp;
if (is_sink)
queue->sink_tainted = TRUE;
else
queue->src_tainted = TRUE;
/* calc diff with other end */
update_time_level (queue);
if (is_sink && !GST_CLOCK_STIME_IS_VALID (queue->sink_start_time)) {
queue->sink_start_time = my_segment_to_running_time (segment, timestamp);
GST_DEBUG_OBJECT (queue, "Start time updated to %" GST_STIME_FORMAT,
GST_STIME_ARGS (queue->sink_start_time));
}
if (GST_CLOCK_TIME_IS_VALID (duration)) {
timestamp += duration;
}
segment->position = timestamp;
if (is_sink)
queue->sink_tainted = TRUE;
else
queue->src_tainted = TRUE;
/* calc diff with other end */
update_time_level (queue);
}

View file

@ -832,28 +832,28 @@ apply_gap (GstQueue2 * queue, GstEvent * event,
gst_event_parse_gap (event, &timestamp, &duration);
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
if (is_sink && !GST_CLOCK_TIME_IS_VALID (queue->sink_start_time)) {
queue->sink_start_time = gst_segment_to_running_time (segment,
GST_FORMAT_TIME, timestamp);
GST_DEBUG_OBJECT (queue, "Start time updated to %" GST_TIME_FORMAT,
GST_TIME_ARGS (queue->sink_start_time));
}
g_return_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp));
if (GST_CLOCK_TIME_IS_VALID (duration)) {
timestamp += duration;
}
segment->position = timestamp;
if (is_sink)
queue->sink_tainted = TRUE;
else
queue->src_tainted = TRUE;
/* calc diff with other end */
update_time_level (queue);
if (is_sink && !GST_CLOCK_TIME_IS_VALID (queue->sink_start_time)) {
queue->sink_start_time = gst_segment_to_running_time (segment,
GST_FORMAT_TIME, timestamp);
GST_DEBUG_OBJECT (queue, "Start time updated to %" GST_TIME_FORMAT,
GST_TIME_ARGS (queue->sink_start_time));
}
if (GST_CLOCK_TIME_IS_VALID (duration)) {
timestamp += duration;
}
segment->position = timestamp;
if (is_sink)
queue->sink_tainted = TRUE;
else
queue->src_tainted = TRUE;
/* calc diff with other end */
update_time_level (queue);
}
static void