GstDataQueueSize max_size, extra_size;
GstClockTime cur_time;
gboolean is_eos;
+ gboolean is_sparse;
gboolean flushing;
/* Protected by global lock */
size.bytes, sq->max_size.bytes, sq->cur_time, sq->max_size.time);
/* get bytes and time percentages and take the max */
- if (sq->is_eos || sq->srcresult == GST_FLOW_NOT_LINKED) {
+ if (sq->is_eos || sq->srcresult == GST_FLOW_NOT_LINKED || sq->is_sparse) {
percent = 100;
} else {
percent = 0;
switch (type) {
case GST_EVENT_STREAM_START:
+ {
+ if (mq->sync_by_running_time) {
+ GstStreamFlags stream_flags;
+ gst_event_parse_stream_flags (event, &stream_flags);
+ if ((stream_flags & GST_STREAM_FLAG_SPARSE)) {
+ GST_INFO_OBJECT (mq, "SingleQueue %d is a sparse stream", sq->id);
+ sq->is_sparse = TRUE;
+ }
+ sq->thread = g_thread_self ();
+ }
+
/* Remove EOS flag */
sq->is_eos = FALSE;
+ }
break;
case GST_EVENT_FLUSH_START:
GST_DEBUG_OBJECT (mq, "SingleQueue %d : received flush start event",
GST_MULTI_QUEUE_MUTEX_LOCK (mq);
/* check if we reached the hard time/bytes limits */
- if (sq->is_eos || IS_FILLED (sq, bytes, size.bytes) ||
+ if (sq->is_eos || sq->is_sparse || IS_FILLED (sq, bytes, size.bytes) ||
IS_FILLED (sq, time, sq->cur_time)) {
goto done;
}
}
GST_LOG_OBJECT (mq, "Checking Queue %d", oq->id);
- if (gst_data_queue_is_empty (oq->queue)) {
+ if (gst_data_queue_is_empty (oq->queue) && !oq->is_sparse) {
GST_LOG_OBJECT (mq, "Queue %d is empty", oq->id);
empty_found = TRUE;
break;
gst_data_queue_limits_changed (oq->queue);
}
}
- if (!gst_data_queue_is_empty (oq->queue))
+ if (!gst_data_queue_is_empty (oq->queue) || oq->is_sparse)
empty = FALSE;
}
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
return TRUE;
/* check time or bytes */
- res = IS_FILLED (sq, time, sq->cur_time) || IS_FILLED (sq, bytes, bytes);
+ res = IS_FILLED (sq, bytes, bytes);
+ /* We only care about limits in time if we're not a sparse stream or
+ * we're not syncing by running time */
+ if (!sq->is_sparse || !mq->sync_by_running_time)
+ res |= IS_FILLED (sq, time, sq->cur_time);
return res;
}
(GstDataQueueFullCallback) single_queue_overrun_cb,
(GstDataQueueEmptyCallback) single_queue_underrun_cb, sq);
sq->is_eos = FALSE;
+ sq->is_sparse = FALSE;
sq->flushing = FALSE;
gst_segment_init (&sq->sink_segment, GST_FORMAT_TIME);
gst_segment_init (&sq->src_segment, GST_FORMAT_TIME);