G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
if (format == GST_FORMAT_BYTES) {
- if (QUEUE_IS_USING_TEMP_FILE (queue)) {
+ if (!QUEUE_IS_USING_QUEUE (queue)) {
/* start is where we'll be getting from and as such writing next */
queue->current = add_range (queue, start);
/* update the stats for this range */
GstEvent *event;
gboolean res;
+ /* until we receive the FLUSH_STOP from this seek, we skip data */
+ queue->seeking = TRUE;
GST_QUEUE2_MUTEX_UNLOCK (queue);
GST_DEBUG_OBJECT (queue, "Seeking to %" G_GUINT64_FORMAT, offset);
guint block_length, remaining, read_length;
gint64 read_return;
guint64 rb_size;
+ guint64 max_size;
guint64 rpos;
/* allocate the output buffer of the requested size */
rpos = offset;
rb_size = queue->ring_buffer_max_size;
+ max_size = QUEUE_MAX_BYTES (queue);
remaining = length;
while (remaining > 0) {
GST_DEBUG_OBJECT (queue,
"reading %" G_GUINT64_FORMAT ", writing %" G_GUINT64_FORMAT
- ", level %" G_GUINT64_FORMAT,
- rpos, queue->current->writing_pos, level);
+ ", level %" G_GUINT64_FORMAT ", max %" G_GUINT64_FORMAT,
+ rpos, queue->current->writing_pos, level, max_size);
- if (level >= rb_size) {
+ if (level >= max_size) {
/* we don't have the data but if we have a ring buffer that is full, we
* need to read */
GST_DEBUG_OBJECT (queue,
- "ring buffer full, reading ring-buffer-max-size %"
- G_GUINT64_FORMAT " bytes", rb_size);
- read_length = rb_size;
+ "ring buffer full, reading QUEUE_MAX_BYTES %"
+ G_GUINT64_FORMAT " bytes", max_size);
+ read_length = max_size;
} else if (queue->is_eos) {
/* won't get any more data so read any data we have */
if (level) {
"EOS hit but read %" G_GUINT64_FORMAT " bytes that we have",
level);
read_length = level;
+ remaining = level;
+ length = level;
} else {
GST_DEBUG_OBJECT (queue,
"EOS hit and we don't have any requested data");
case GST_EVENT_FLUSH_START:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "received flush start event");
- if (QUEUE_IS_USING_QUEUE (queue)) {
+ if (queue->srcpad->mode == GST_ACTIVATE_PUSH) {
/* forward event */
gst_pad_push_event (queue->srcpad, event);
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "received flush stop event");
- if (QUEUE_IS_USING_QUEUE (queue)) {
+ if (queue->srcpad->mode == GST_ACTIVATE_PUSH) {
/* forward event */
gst_pad_push_event (queue->srcpad, event);
queue->sinkresult = GST_FLOW_OK;
queue->is_eos = FALSE;
queue->unexpected = FALSE;
+ queue->seeking = FALSE;
/* reset rate counters */
reset_rate_timer (queue);
gst_pad_start_task (queue->srcpad, (GstTaskFunction) gst_queue2_loop,
if (queue->unexpected)
goto out_unexpected;
+ /* while we didn't receive the newsegment, we're seeking and we skip data */
+ if (queue->seeking)
+ goto out_seeking;
+
if (!gst_queue2_wait_free_space (queue))
goto out_flushing;
return GST_FLOW_UNEXPECTED;
}
+out_seeking:
+ {
+ GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we are seeking");
+ GST_QUEUE2_MUTEX_UNLOCK (queue);
+ gst_mini_object_unref (item);
+
+ return GST_FLOW_OK;
+ }
out_unexpected:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
/* now unblock the getrange function */
GST_QUEUE2_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_OK;
- if (queue->current) {
- /* forget the highest read offset, we'll calculate a new one when we
- * get the next getrange request. We need to do this in order to reset
- * the buffering percentage */
- queue->current->max_reading_pos = 0;
- }
GST_QUEUE2_MUTEX_UNLOCK (queue);
/* when using a temp file, we eat the event */