mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
Merge remote-tracking branch 'origin/0.10'
Conflicts: gst/gsttoc.c plugins/elements/gstqueue2.c
This commit is contained in:
commit
bfc87ac576
2 changed files with 61 additions and 11 deletions
|
@ -664,8 +664,6 @@ apply_segment (GstQueue2 * queue, GstEvent * event, GstSegment * segment,
|
|||
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
||||
/* start is where we'll be getting from and as such writing next */
|
||||
queue->current = add_range (queue, segment->start);
|
||||
/* update the stats for this range */
|
||||
update_cur_level (queue, queue->current);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1228,15 +1226,12 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
|||
}
|
||||
|
||||
if (read_length == 0) {
|
||||
if (QUEUE_IS_USING_RING_BUFFER (queue)
|
||||
&& queue->current->max_reading_pos > rpos) {
|
||||
/* protect cached data (data between offset and max_reading_pos)
|
||||
* and update current level */
|
||||
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
||||
GST_DEBUG_OBJECT (queue,
|
||||
"protecting cached data [%" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT
|
||||
"]", rpos, queue->current->max_reading_pos);
|
||||
queue->current->max_reading_pos = rpos;
|
||||
update_cur_level (queue, queue->current);
|
||||
"update current position [%" G_GUINT64_FORMAT "-%"
|
||||
G_GUINT64_FORMAT "]", rpos, queue->current->max_reading_pos);
|
||||
update_cur_pos (queue, queue->current, rpos);
|
||||
GST_QUEUE2_SIGNAL_DEL (queue);
|
||||
}
|
||||
GST_DEBUG_OBJECT (queue, "waiting for add");
|
||||
GST_QUEUE2_WAIT_ADD_CHECK (queue, queue->srcresult, out_flushing);
|
||||
|
@ -1571,7 +1566,7 @@ gst_queue2_create_write (GstQueue2 * queue, GstBuffer * buffer)
|
|||
data = info.data;
|
||||
|
||||
GST_DEBUG_OBJECT (queue, "Writing %u bytes to %" G_GUINT64_FORMAT, size,
|
||||
GST_BUFFER_OFFSET (buffer));
|
||||
writing_pos);
|
||||
|
||||
while (size > 0) {
|
||||
guint to_write;
|
||||
|
|
|
@ -207,6 +207,60 @@ GST_START_TEST (test_simple_create_destroy)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
static gpointer
|
||||
push_buffer (GstPad * sinkpad)
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (1 * 1024);
|
||||
|
||||
gst_pad_chain (sinkpad, buffer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GST_START_TEST (test_filled_read)
|
||||
{
|
||||
GstElement *queue2;
|
||||
GstBuffer *buffer;
|
||||
GstPad *sinkpad, *srcpad;
|
||||
GThread *thread;
|
||||
|
||||
queue2 = gst_element_factory_make ("queue2", NULL);
|
||||
sinkpad = gst_element_get_static_pad (queue2, "sink");
|
||||
srcpad = gst_element_get_static_pad (queue2, "src");
|
||||
|
||||
g_object_set (queue2, "ring-buffer-max-size", (guint64) 5 * 1024,
|
||||
"use-buffering", FALSE,
|
||||
"max-size-buffers", (guint) 0, "max-size-time", (guint64) 0,
|
||||
"max-size-bytes", (guint) 4 * 1024, NULL);
|
||||
|
||||
gst_pad_activate_pull (srcpad, TRUE);
|
||||
gst_element_set_state (queue2, GST_STATE_PLAYING);
|
||||
|
||||
/* fill up the buffer */
|
||||
buffer = gst_buffer_new_and_alloc (4 * 1024);
|
||||
fail_unless (gst_pad_chain (sinkpad, buffer) == GST_FLOW_OK);
|
||||
|
||||
thread = g_thread_create ((GThreadFunc) push_buffer, sinkpad, TRUE, NULL);
|
||||
|
||||
fail_unless (gst_pad_get_range (srcpad, 1024, 4 * 1024,
|
||||
&buffer) == GST_FLOW_OK);
|
||||
|
||||
fail_unless (GST_BUFFER_SIZE (buffer) == 4 * 1024);
|
||||
|
||||
gst_element_set_state (queue2, GST_STATE_NULL);
|
||||
|
||||
g_thread_join (thread);
|
||||
|
||||
gst_object_unref (sinkpad);
|
||||
gst_object_unref (srcpad);
|
||||
gst_object_unref (queue2);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
|
||||
static Suite *
|
||||
queue2_suite (void)
|
||||
{
|
||||
|
@ -219,6 +273,7 @@ queue2_suite (void)
|
|||
tcase_add_test (tc_chain, test_simple_pipeline_ringbuffer);
|
||||
tcase_add_test (tc_chain, test_simple_shutdown_while_running);
|
||||
tcase_add_test (tc_chain, test_simple_shutdown_while_running_ringbuffer);
|
||||
tcase_add_test (tc_chain, test_filled_read);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue