mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 13:36:39 +00:00
queue2: fix mixing of return values
This commit is contained in:
parent
070cdaab7c
commit
7e2a79fa1d
1 changed files with 22 additions and 16 deletions
|
@ -1098,9 +1098,9 @@ gst_queue2_have_data (GstQueue2 * queue, guint64 offset, guint length)
|
||||||
#define FSEEK_FILE(file,offset) (fseek (file, offset, SEEK_SET) != 0)
|
#define FSEEK_FILE(file,offset) (fseek (file, offset, SEEK_SET) != 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static gint64
|
static GstFlowReturn
|
||||||
gst_queue2_read_data_at_offset (GstQueue2 * queue, guint64 offset, guint length,
|
gst_queue2_read_data_at_offset (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
guint8 * dst)
|
guint8 * dst, gint64 * read_return)
|
||||||
{
|
{
|
||||||
guint8 *ring_buffer;
|
guint8 *ring_buffer;
|
||||||
size_t res;
|
size_t res;
|
||||||
|
@ -1132,7 +1132,9 @@ gst_queue2_read_data_at_offset (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
goto eos;
|
goto eos;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
*read_return = res;
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
seek_failed:
|
seek_failed:
|
||||||
{
|
{
|
||||||
|
@ -1159,9 +1161,9 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
guint64 file_offset;
|
guint64 file_offset;
|
||||||
guint block_length, remaining, read_length;
|
guint block_length, remaining, read_length;
|
||||||
gint64 read_return;
|
|
||||||
guint64 rb_size;
|
guint64 rb_size;
|
||||||
guint64 rpos;
|
guint64 rpos;
|
||||||
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
/* allocate the output buffer of the requested size */
|
/* allocate the output buffer of the requested size */
|
||||||
buf = gst_buffer_new_and_alloc (length);
|
buf = gst_buffer_new_and_alloc (length);
|
||||||
|
@ -1207,12 +1209,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;
|
||||||
} else {
|
} else
|
||||||
GST_DEBUG_OBJECT (queue,
|
goto hit_eos;
|
||||||
"EOS hit and we don't have any requested data");
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
return GST_FLOW_UNEXPECTED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1256,10 +1254,12 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
|
|
||||||
/* while we still have data to read, we loop */
|
/* while we still have data to read, we loop */
|
||||||
while (read_length > 0) {
|
while (read_length > 0) {
|
||||||
read_return =
|
gint64 read_return;
|
||||||
|
|
||||||
|
ret =
|
||||||
gst_queue2_read_data_at_offset (queue, file_offset, block_length,
|
gst_queue2_read_data_at_offset (queue, file_offset, block_length,
|
||||||
data);
|
data, &read_return);
|
||||||
if (read_return < 0)
|
if (ret != GST_FLOW_OK)
|
||||||
goto read_error;
|
goto read_error;
|
||||||
|
|
||||||
file_offset += read_return;
|
file_offset += read_return;
|
||||||
|
@ -1285,9 +1285,15 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
||||||
|
|
||||||
*buffer = buf;
|
*buffer = buf;
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return ret;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
hit_eos:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (queue, "EOS hit and we don't have any requested data");
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
return GST_FLOW_UNEXPECTED;
|
||||||
|
}
|
||||||
out_flushing:
|
out_flushing:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (queue, "we are flushing");
|
GST_DEBUG_OBJECT (queue, "we are flushing");
|
||||||
|
@ -1299,7 +1305,7 @@ read_error:
|
||||||
GST_DEBUG_OBJECT (queue, "we have a read error");
|
GST_DEBUG_OBJECT (queue, "we have a read error");
|
||||||
gst_buffer_unmap (buf, data, 0);
|
gst_buffer_unmap (buf, data, 0);
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
return read_return;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2815,7 +2821,7 @@ gst_queue2_src_activate_pull (GstPad * pad, gboolean active)
|
||||||
result = gst_queue2_open_temp_location_file (queue);
|
result = gst_queue2_open_temp_location_file (queue);
|
||||||
} else if (!queue->ring_buffer) {
|
} else if (!queue->ring_buffer) {
|
||||||
queue->ring_buffer = g_malloc (queue->ring_buffer_max_size);
|
queue->ring_buffer = g_malloc (queue->ring_buffer_max_size);
|
||||||
result = ! !queue->ring_buffer;
|
result = !!queue->ring_buffer;
|
||||||
} else {
|
} else {
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue