mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 15:36:42 +00:00
Merge branch '0.10'
Conflicts: plugins/elements/gstqueue2.c
This commit is contained in:
commit
0ba0f7cd5b
1 changed files with 26 additions and 15 deletions
|
@ -1057,20 +1057,27 @@ gst_queue2_have_data (GstQueue2 * queue, guint64 offset, guint length)
|
||||||
(offset + length) - range->writing_pos);
|
(offset + length) - range->writing_pos);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
GST_INFO_OBJECT (queue, "not found in any range");
|
GST_INFO_OBJECT (queue, "not found in any range off %" G_GUINT64_FORMAT
|
||||||
/* we don't have the range, see how far away we are, FIXME, find a good
|
" len %u", offset, length);
|
||||||
* threshold based on the incoming rate. */
|
/* we don't have the range, see how far away we are */
|
||||||
if (!queue->is_eos && queue->current) {
|
if (!queue->is_eos && queue->current) {
|
||||||
|
/* FIXME, find a good threshold based on the incoming rate. */
|
||||||
|
guint64 threshold = 1024 * 512;
|
||||||
|
|
||||||
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
||||||
if (offset < queue->current->offset || offset >
|
guint64 distance;
|
||||||
queue->current->writing_pos + QUEUE_MAX_BYTES (queue) -
|
|
||||||
queue->cur_level.bytes) {
|
distance = QUEUE_MAX_BYTES (queue) - queue->cur_level.bytes;
|
||||||
perform_seek_to_offset (queue, offset);
|
/* don't wait for the complete buffer to fill */
|
||||||
} else {
|
distance = MIN (distance, threshold);
|
||||||
|
|
||||||
|
if (offset >= queue->current->offset && offset <=
|
||||||
|
queue->current->writing_pos + distance) {
|
||||||
GST_INFO_OBJECT (queue,
|
GST_INFO_OBJECT (queue,
|
||||||
"requested data is within range, wait for data");
|
"requested data is within range, wait for data");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else if (offset < queue->current->writing_pos + 200000) {
|
} else if (offset < queue->current->writing_pos + threshold) {
|
||||||
update_cur_pos (queue, queue->current, offset + length);
|
update_cur_pos (queue, queue->current, offset + length);
|
||||||
GST_INFO_OBJECT (queue, "wait for data");
|
GST_INFO_OBJECT (queue, "wait for data");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1157,6 +1164,7 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
guint64 file_offset;
|
guint64 file_offset;
|
||||||
guint block_length, remaining, read_length;
|
guint block_length, remaining, read_length;
|
||||||
guint64 rb_size;
|
guint64 rb_size;
|
||||||
|
guint64 max_size;
|
||||||
guint64 rpos;
|
guint64 rpos;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
|
@ -1174,6 +1182,7 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
|
|
||||||
rpos = offset;
|
rpos = offset;
|
||||||
rb_size = queue->ring_buffer_max_size;
|
rb_size = queue->ring_buffer_max_size;
|
||||||
|
max_size = QUEUE_MAX_BYTES (queue);
|
||||||
|
|
||||||
remaining = length;
|
remaining = length;
|
||||||
while (remaining > 0) {
|
while (remaining > 0) {
|
||||||
|
@ -1192,16 +1201,16 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (queue,
|
GST_DEBUG_OBJECT (queue,
|
||||||
"reading %" G_GUINT64_FORMAT ", writing %" G_GUINT64_FORMAT
|
"reading %" G_GUINT64_FORMAT ", writing %" G_GUINT64_FORMAT
|
||||||
", level %" G_GUINT64_FORMAT,
|
", level %" G_GUINT64_FORMAT ", max %" G_GUINT64_FORMAT,
|
||||||
rpos, queue->current->writing_pos, level);
|
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
|
/* we don't have the data but if we have a ring buffer that is full, we
|
||||||
* need to read */
|
* need to read */
|
||||||
GST_DEBUG_OBJECT (queue,
|
GST_DEBUG_OBJECT (queue,
|
||||||
"ring buffer full, reading ring-buffer-max-size %"
|
"ring buffer full, reading QUEUE_MAX_BYTES %"
|
||||||
G_GUINT64_FORMAT " bytes", rb_size);
|
G_GUINT64_FORMAT " bytes", max_size);
|
||||||
read_length = rb_size;
|
read_length = max_size;
|
||||||
} else if (queue->is_eos) {
|
} else if (queue->is_eos) {
|
||||||
/* won't get any more data so read any data we have */
|
/* won't get any more data so read any data we have */
|
||||||
if (level) {
|
if (level) {
|
||||||
|
@ -1209,6 +1218,8 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
"EOS hit but read %" G_GUINT64_FORMAT " bytes that we have",
|
"EOS hit but read %" G_GUINT64_FORMAT " bytes that we have",
|
||||||
level);
|
level);
|
||||||
read_length = level;
|
read_length = level;
|
||||||
|
remaining = level;
|
||||||
|
length = level;
|
||||||
} else
|
} else
|
||||||
goto hit_eos;
|
goto hit_eos;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue