plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* unit test for tee
|
|
|
|
*
|
|
|
|
* Copyright (C) <2007> Wim Taymans <wim dot taymans at gmail dot com>
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
* Copyright (C) <2008> Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
|
|
|
|
* Copyright (C) <2008> Christian Berentsen <christian.berentsen@tandberg.com>
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
#include <gst/check/gstcheck.h>
|
|
|
|
|
|
|
|
static void
|
|
|
|
handoff (GstElement * fakesink, GstBuffer * buf, GstPad * pad, guint * count)
|
|
|
|
{
|
|
|
|
*count = *count + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* construct fakesrc num-buffers=3 ! tee name=t ! queue ! fakesink t. ! queue !
|
|
|
|
* fakesink. Each fakesink should exactly receive 3 buffers.
|
|
|
|
*/
|
|
|
|
GST_START_TEST (test_num_buffers)
|
|
|
|
{
|
2007-11-01 19:19:10 +00:00
|
|
|
#define NUM_SUBSTREAMS 15
|
|
|
|
#define NUM_BUFFERS 3
|
|
|
|
GstElement *pipeline, *src, *tee;
|
|
|
|
GstElement *queues[NUM_SUBSTREAMS];
|
|
|
|
GstElement *sinks[NUM_SUBSTREAMS];
|
|
|
|
GstPad *req_pads[NUM_SUBSTREAMS];
|
|
|
|
guint counts[NUM_SUBSTREAMS];
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
GstBus *bus;
|
|
|
|
GstMessage *msg;
|
2007-11-01 19:19:10 +00:00
|
|
|
gint i;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("pipeline");
|
|
|
|
src = gst_check_setup_element ("fakesrc");
|
|
|
|
g_object_set (src, "num-buffers", NUM_BUFFERS, NULL);
|
|
|
|
tee = gst_check_setup_element ("tee");
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (pipeline), src));
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (pipeline), tee));
|
|
|
|
fail_unless (gst_element_link (src, tee));
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_SUBSTREAMS; ++i) {
|
|
|
|
GstPad *qpad;
|
|
|
|
gchar name[32];
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
2007-11-01 19:19:10 +00:00
|
|
|
counts[i] = 0;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
2007-11-01 19:19:10 +00:00
|
|
|
queues[i] = gst_check_setup_element ("queue");
|
|
|
|
g_snprintf (name, 32, "queue%d", i);
|
|
|
|
gst_object_set_name (GST_OBJECT (queues[i]), name);
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (pipeline), queues[i]));
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
2007-11-01 19:19:10 +00:00
|
|
|
sinks[i] = gst_check_setup_element ("fakesink");
|
|
|
|
g_snprintf (name, 32, "sink%d", i);
|
|
|
|
gst_object_set_name (GST_OBJECT (sinks[i]), name);
|
|
|
|
fail_unless (gst_bin_add (GST_BIN (pipeline), sinks[i]));
|
|
|
|
fail_unless (gst_element_link (queues[i], sinks[i]));
|
|
|
|
g_object_set (sinks[i], "signal-handoffs", TRUE, NULL);
|
|
|
|
g_signal_connect (sinks[i], "handoff", (GCallback) handoff, &counts[i]);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
2011-11-03 16:49:45 +00:00
|
|
|
req_pads[i] = gst_element_get_request_pad (tee, "src_%u");
|
2007-11-01 19:19:10 +00:00
|
|
|
fail_unless (req_pads[i] != NULL);
|
|
|
|
|
2008-05-21 15:57:52 +00:00
|
|
|
qpad = gst_element_get_static_pad (queues[i], "sink");
|
2007-11-01 19:19:10 +00:00
|
|
|
fail_unless_equals_int (gst_pad_link (req_pads[i], qpad), GST_PAD_LINK_OK);
|
|
|
|
gst_object_unref (qpad);
|
|
|
|
}
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
|
|
|
bus = gst_element_get_bus (pipeline);
|
|
|
|
fail_if (bus == NULL);
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
|
|
|
|
|
|
msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
|
|
|
|
fail_if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_EOS);
|
|
|
|
gst_message_unref (msg);
|
|
|
|
|
2007-11-01 19:19:10 +00:00
|
|
|
for (i = 0; i < NUM_SUBSTREAMS; ++i) {
|
|
|
|
fail_unless_equals_int (counts[i], NUM_BUFFERS);
|
|
|
|
}
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
|
|
gst_object_unref (bus);
|
2007-11-01 19:19:10 +00:00
|
|
|
|
|
|
|
for (i = 0; i < NUM_SUBSTREAMS; ++i) {
|
|
|
|
gst_element_release_request_pad (tee, req_pads[i]);
|
|
|
|
gst_object_unref (req_pads[i]);
|
|
|
|
}
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
gst_object_unref (pipeline);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
/* we use fakesrc ! tee ! fakesink and then randomly request/release and link
|
|
|
|
* some pads from tee. This should happily run without any errors. */
|
|
|
|
GST_START_TEST (test_stress)
|
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *tee;
|
2010-03-03 10:45:38 +00:00
|
|
|
const gchar *desc;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
GstBus *bus;
|
|
|
|
GstMessage *msg;
|
|
|
|
gint i;
|
|
|
|
|
2007-07-16 14:55:26 +00:00
|
|
|
/* Pump 1000 buffers (10 bytes each) per second through tee for 5 secs */
|
|
|
|
desc = "fakesrc datarate=10000 sizemin=10 sizemax=10 num-buffers=5000 ! "
|
2012-03-01 10:06:49 +00:00
|
|
|
"video/x-raw,framerate=25/1 ! tee name=t ! "
|
2007-07-16 14:55:26 +00:00
|
|
|
"queue max-size-buffers=2 ! fakesink sync=true";
|
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
pipeline = gst_parse_launch (desc, NULL);
|
|
|
|
fail_if (pipeline == NULL);
|
|
|
|
|
|
|
|
tee = gst_bin_get_by_name (GST_BIN (pipeline), "t");
|
|
|
|
fail_if (tee == NULL);
|
|
|
|
|
|
|
|
/* bring the pipeline to PLAYING, then start switching */
|
|
|
|
bus = gst_element_get_bus (pipeline);
|
|
|
|
fail_if (bus == NULL);
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2007-07-16 14:55:26 +00:00
|
|
|
/* Wait for the pipeline to hit playing so that parse_launch can do the
|
|
|
|
* initial link, otherwise we perform linking from multiple threads and cause
|
|
|
|
* trouble */
|
|
|
|
gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 50000; i++) {
|
|
|
|
GstPad *pad;
|
|
|
|
|
2011-11-03 16:49:45 +00:00
|
|
|
pad = gst_element_get_request_pad (tee, "src_%u");
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
gst_element_release_request_pad (tee, pad);
|
|
|
|
gst_object_unref (pad);
|
2007-07-16 14:55:26 +00:00
|
|
|
|
|
|
|
if ((msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, 0)))
|
|
|
|
break;
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* now wait for completion or error */
|
2007-07-16 14:55:26 +00:00
|
|
|
if (msg == NULL)
|
|
|
|
msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
fail_if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_EOS);
|
|
|
|
gst_message_unref (msg);
|
|
|
|
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
|
|
gst_object_unref (tee);
|
|
|
|
gst_object_unref (bus);
|
|
|
|
gst_object_unref (pipeline);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstElement *tee;
|
|
|
|
GstCaps *caps;
|
|
|
|
GstPad *start_srcpad;
|
|
|
|
GstPad *tee_sinkpad;
|
|
|
|
GstPad *tee_srcpad;
|
|
|
|
GstPad *final_sinkpad;
|
|
|
|
GThread *app_thread;
|
|
|
|
gint countdown;
|
|
|
|
gboolean app_thread_prepped;
|
|
|
|
gboolean bufferalloc_blocked;
|
|
|
|
} BufferAllocHarness;
|
|
|
|
|
2010-03-02 21:58:06 +00:00
|
|
|
static void
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
buffer_alloc_harness_setup (BufferAllocHarness * h, gint countdown)
|
|
|
|
{
|
2011-10-09 14:49:45 +00:00
|
|
|
h->app_thread = NULL;
|
|
|
|
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
h->tee = gst_check_setup_element ("tee");
|
|
|
|
fail_if (h->tee == NULL);
|
|
|
|
|
|
|
|
h->countdown = countdown;
|
|
|
|
|
|
|
|
fail_unless_equals_int (gst_element_set_state (h->tee, GST_STATE_PLAYING),
|
|
|
|
TRUE);
|
|
|
|
|
2012-03-01 10:06:49 +00:00
|
|
|
h->caps = gst_caps_new_empty_simple ("video/x-raw");
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
|
|
|
|
h->start_srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
|
|
fail_if (h->start_srcpad == NULL);
|
|
|
|
fail_unless (gst_pad_set_active (h->start_srcpad, TRUE) == TRUE);
|
2011-06-06 10:23:04 +00:00
|
|
|
fail_unless (gst_pad_set_caps (h->start_srcpad, h->caps) == TRUE);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
|
|
|
|
h->tee_sinkpad = gst_element_get_static_pad (h->tee, "sink");
|
|
|
|
fail_if (h->tee_sinkpad == NULL);
|
|
|
|
|
2011-11-03 16:49:45 +00:00
|
|
|
h->tee_srcpad = gst_element_get_request_pad (h->tee, "src_%u");
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
fail_if (h->tee_srcpad == NULL);
|
|
|
|
|
|
|
|
h->final_sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
|
|
fail_if (h->final_sinkpad == NULL);
|
|
|
|
fail_unless (gst_pad_set_active (h->final_sinkpad, TRUE) == TRUE);
|
2011-06-06 10:23:04 +00:00
|
|
|
fail_unless (gst_pad_set_caps (h->final_sinkpad, h->caps) == TRUE);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
g_object_set_qdata (G_OBJECT (h->final_sinkpad),
|
|
|
|
g_quark_from_static_string ("buffer-alloc-harness"), h);
|
|
|
|
|
|
|
|
fail_unless_equals_int (gst_pad_link (h->start_srcpad, h->tee_sinkpad),
|
|
|
|
GST_PAD_LINK_OK);
|
|
|
|
fail_unless_equals_int (gst_pad_link (h->tee_srcpad, h->final_sinkpad),
|
|
|
|
GST_PAD_LINK_OK);
|
|
|
|
}
|
|
|
|
|
2010-03-02 21:58:06 +00:00
|
|
|
static void
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
buffer_alloc_harness_teardown (BufferAllocHarness * h)
|
|
|
|
{
|
2011-04-29 11:26:19 +00:00
|
|
|
if (h->app_thread)
|
|
|
|
g_thread_join (h->app_thread);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
|
|
|
|
gst_pad_set_active (h->final_sinkpad, FALSE);
|
|
|
|
gst_object_unref (h->final_sinkpad);
|
|
|
|
gst_object_unref (h->tee_srcpad);
|
|
|
|
gst_object_unref (h->tee_sinkpad);
|
|
|
|
gst_pad_set_active (h->start_srcpad, FALSE);
|
|
|
|
gst_object_unref (h->start_srcpad);
|
|
|
|
gst_caps_unref (h->caps);
|
|
|
|
gst_check_teardown_element (h->tee);
|
|
|
|
}
|
|
|
|
|
2011-04-29 11:26:19 +00:00
|
|
|
#if 0
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
static gpointer
|
|
|
|
app_thread_func (gpointer data)
|
|
|
|
{
|
|
|
|
BufferAllocHarness *h = data;
|
|
|
|
|
|
|
|
/* Signal that we are about to call release_request_pad(). */
|
2012-09-12 10:22:53 +00:00
|
|
|
g_mutex_lock (&check_mutex);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
h->app_thread_prepped = TRUE;
|
2012-09-12 10:22:53 +00:00
|
|
|
g_cond_signal (&check_cond);
|
|
|
|
g_mutex_unlock (&check_mutex);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
|
|
|
|
/* Simulate that the app releases the pad while the streaming thread is in
|
|
|
|
* buffer_alloc below. */
|
|
|
|
gst_element_release_request_pad (h->tee, h->tee_srcpad);
|
|
|
|
|
|
|
|
/* Signal the bufferalloc function below if it's still waiting. */
|
2012-09-12 10:22:53 +00:00
|
|
|
g_mutex_lock (&check_mutex);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
h->bufferalloc_blocked = FALSE;
|
2012-09-12 10:22:53 +00:00
|
|
|
g_cond_signal (&check_cond);
|
|
|
|
g_mutex_unlock (&check_mutex);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-04-29 11:26:19 +00:00
|
|
|
#endif
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
|
2011-04-29 11:26:19 +00:00
|
|
|
#if 0
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
final_sinkpad_bufferalloc (GstPad * pad, guint64 offset, guint size,
|
|
|
|
GstCaps * caps, GstBuffer ** buf)
|
|
|
|
{
|
|
|
|
BufferAllocHarness *h;
|
|
|
|
GTimeVal deadline;
|
|
|
|
|
|
|
|
h = g_object_get_qdata (G_OBJECT (pad),
|
|
|
|
g_quark_from_static_string ("buffer-alloc-harness"));
|
|
|
|
g_assert (h != NULL);
|
|
|
|
|
|
|
|
if (--(h->countdown) == 0) {
|
|
|
|
/* Time to make the app release the pad. */
|
|
|
|
h->app_thread_prepped = FALSE;
|
|
|
|
h->bufferalloc_blocked = TRUE;
|
|
|
|
|
2012-09-12 09:52:25 +00:00
|
|
|
h->app_thread = g_thread_try_new ("gst-check", app_thread_func, h, NULL);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
fail_if (h->app_thread == NULL);
|
|
|
|
|
|
|
|
/* Wait for the app thread to get ready to call release_request_pad(). */
|
2012-09-12 10:22:53 +00:00
|
|
|
g_mutex_lock (&check_mutex);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
while (!h->app_thread_prepped)
|
2012-09-12 10:22:53 +00:00
|
|
|
g_cond_wait (&check_cond, &check_mutex);
|
|
|
|
g_mutex_unlock (&check_mutex);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
|
|
|
|
/* Now wait for it to do that within a second, to avoid deadlocking
|
|
|
|
* in the event of future changes to the locking semantics. */
|
2012-09-12 10:22:53 +00:00
|
|
|
g_mutex_lock (&check_mutex);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
g_get_current_time (&deadline);
|
|
|
|
deadline.tv_sec += 1;
|
|
|
|
while (h->bufferalloc_blocked) {
|
2012-09-12 10:22:53 +00:00
|
|
|
if (!g_cond_timed_wait (&check_cond, &check_mutex, &deadline))
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-09-12 10:22:53 +00:00
|
|
|
g_mutex_unlock (&check_mutex);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*buf = gst_buffer_new_and_alloc (size);
|
|
|
|
gst_buffer_set_caps (*buf, caps);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2011-04-29 11:26:19 +00:00
|
|
|
#endif
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
|
|
|
|
/* Simulate an app releasing the pad while the first alloc_buffer() is in
|
|
|
|
* progress. */
|
|
|
|
GST_START_TEST (test_release_while_buffer_alloc)
|
|
|
|
{
|
|
|
|
BufferAllocHarness h;
|
|
|
|
|
|
|
|
buffer_alloc_harness_setup (&h, 1);
|
|
|
|
|
|
|
|
buffer_alloc_harness_teardown (&h);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
/* Simulate an app releasing the pad while the second alloc_buffer() is in
|
|
|
|
* progress. */
|
|
|
|
GST_START_TEST (test_release_while_second_buffer_alloc)
|
|
|
|
{
|
|
|
|
BufferAllocHarness h;
|
|
|
|
|
|
|
|
buffer_alloc_harness_setup (&h, 2);
|
|
|
|
|
|
|
|
buffer_alloc_harness_teardown (&h);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2008-09-01 10:42:04 +00:00
|
|
|
/* Check the internal pads of tee */
|
|
|
|
GST_START_TEST (test_internal_links)
|
|
|
|
{
|
|
|
|
GstElement *tee;
|
|
|
|
GstPad *sinkpad, *srcpad1, *srcpad2;
|
|
|
|
GstIterator *it;
|
|
|
|
GstIteratorResult res;
|
2011-03-17 10:52:42 +00:00
|
|
|
GValue val1 = { 0, }
|
|
|
|
, val2 = {
|
|
|
|
0,};
|
2008-09-01 10:42:04 +00:00
|
|
|
|
|
|
|
tee = gst_check_setup_element ("tee");
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_static_pad (tee, "sink");
|
|
|
|
fail_unless (sinkpad != NULL);
|
|
|
|
it = gst_pad_iterate_internal_links (sinkpad);
|
|
|
|
fail_unless (it != NULL);
|
|
|
|
|
|
|
|
/* iterator should not return anything */
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_DONE);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (g_value_get_object (&val1) == NULL);
|
2008-09-01 10:42:04 +00:00
|
|
|
|
2011-11-03 16:49:45 +00:00
|
|
|
srcpad1 = gst_element_get_request_pad (tee, "src_%u");
|
2008-09-01 10:42:04 +00:00
|
|
|
fail_unless (srcpad1 != NULL);
|
|
|
|
|
|
|
|
/* iterator should resync */
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_RESYNC);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (g_value_get_object (&val1) == NULL);
|
2008-09-01 10:42:04 +00:00
|
|
|
gst_iterator_resync (it);
|
|
|
|
|
|
|
|
/* we should get something now */
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_OK);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == srcpad1);
|
2008-09-01 10:42:04 +00:00
|
|
|
|
2011-03-17 10:52:42 +00:00
|
|
|
g_value_reset (&val1);
|
2008-09-01 10:42:04 +00:00
|
|
|
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_DONE);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (g_value_get_object (&val1) == NULL);
|
2008-09-01 10:42:04 +00:00
|
|
|
|
2011-11-03 16:49:45 +00:00
|
|
|
srcpad2 = gst_element_get_request_pad (tee, "src_%u");
|
2008-09-01 10:42:04 +00:00
|
|
|
fail_unless (srcpad2 != NULL);
|
|
|
|
|
|
|
|
/* iterator should resync */
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_RESYNC);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (g_value_get_object (&val1) == NULL);
|
2008-09-01 10:42:04 +00:00
|
|
|
gst_iterator_resync (it);
|
|
|
|
|
|
|
|
/* we should get one of the 2 pads now */
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_OK);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == srcpad1
|
|
|
|
|| GST_PAD_CAST (g_value_get_object (&val1)) == srcpad2);
|
2008-09-01 10:42:04 +00:00
|
|
|
|
|
|
|
/* and the other */
|
|
|
|
res = gst_iterator_next (it, &val2);
|
|
|
|
fail_unless (res == GST_ITERATOR_OK);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val2)) == srcpad1
|
|
|
|
|| GST_PAD_CAST (g_value_get_object (&val2)) == srcpad2);
|
|
|
|
fail_unless (g_value_get_object (&val1) != g_value_get_object (&val2));
|
|
|
|
g_value_reset (&val1);
|
|
|
|
g_value_reset (&val2);
|
2008-09-01 10:42:04 +00:00
|
|
|
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_DONE);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (g_value_get_object (&val1) == NULL);
|
2008-09-01 10:42:04 +00:00
|
|
|
|
|
|
|
gst_iterator_free (it);
|
|
|
|
|
|
|
|
/* get an iterator for the other direction */
|
|
|
|
it = gst_pad_iterate_internal_links (srcpad1);
|
|
|
|
fail_unless (it != NULL);
|
|
|
|
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_OK);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == sinkpad);
|
|
|
|
g_value_reset (&val1);
|
2008-09-01 10:42:04 +00:00
|
|
|
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_DONE);
|
|
|
|
gst_iterator_free (it);
|
|
|
|
|
|
|
|
it = gst_pad_iterate_internal_links (srcpad2);
|
|
|
|
fail_unless (it != NULL);
|
|
|
|
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_OK);
|
2011-03-17 10:52:42 +00:00
|
|
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == sinkpad);
|
|
|
|
g_value_reset (&val1);
|
2008-09-01 10:42:04 +00:00
|
|
|
|
|
|
|
res = gst_iterator_next (it, &val1);
|
|
|
|
fail_unless (res == GST_ITERATOR_DONE);
|
|
|
|
|
2011-03-17 10:52:42 +00:00
|
|
|
g_value_unset (&val1);
|
|
|
|
g_value_unset (&val2);
|
2008-09-01 10:42:04 +00:00
|
|
|
gst_iterator_free (it);
|
|
|
|
gst_object_unref (srcpad1);
|
|
|
|
gst_object_unref (srcpad2);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_object_unref (tee);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2008-10-14 12:34:56 +00:00
|
|
|
static GstFlowReturn
|
2011-11-17 11:40:45 +00:00
|
|
|
_fake_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
2008-10-14 12:34:56 +00:00
|
|
|
{
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2011-11-17 11:40:45 +00:00
|
|
|
_fake_chain_error (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
2008-10-14 12:34:56 +00:00
|
|
|
{
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_flow_aggregation)
|
|
|
|
{
|
|
|
|
GstPad *mysrc, *mysink1, *mysink2;
|
|
|
|
GstPad *teesink, *teesrc1, *teesrc2;
|
|
|
|
GstElement *tee;
|
|
|
|
GstBuffer *buffer;
|
2013-05-09 11:32:07 +00:00
|
|
|
GstSegment segment;
|
2008-10-14 12:34:56 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
2011-10-27 15:09:51 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("test/test");
|
2008-10-14 12:34:56 +00:00
|
|
|
|
|
|
|
tee = gst_element_factory_make ("tee", NULL);
|
|
|
|
fail_unless (tee != NULL);
|
|
|
|
teesink = gst_element_get_static_pad (tee, "sink");
|
|
|
|
fail_unless (teesink != NULL);
|
2011-11-03 16:49:45 +00:00
|
|
|
teesrc1 = gst_element_get_request_pad (tee, "src_%u");
|
2008-10-14 12:34:56 +00:00
|
|
|
fail_unless (teesrc1 != NULL);
|
2011-11-03 16:49:45 +00:00
|
|
|
teesrc2 = gst_element_get_request_pad (tee, "src_%u");
|
2008-10-14 12:34:56 +00:00
|
|
|
fail_unless (teesrc2 != NULL);
|
|
|
|
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Creating mysink1");
|
2008-10-14 12:34:56 +00:00
|
|
|
mysink1 = gst_pad_new ("mysink1", GST_PAD_SINK);
|
2011-06-06 10:23:04 +00:00
|
|
|
gst_pad_set_chain_function (mysink1, _fake_chain);
|
|
|
|
gst_pad_set_active (mysink1, TRUE);
|
|
|
|
|
|
|
|
GST_DEBUG ("Creating mysink2");
|
2008-10-14 12:34:56 +00:00
|
|
|
mysink2 = gst_pad_new ("mysink2", GST_PAD_SINK);
|
2011-06-06 10:23:04 +00:00
|
|
|
gst_pad_set_chain_function (mysink2, _fake_chain);
|
|
|
|
gst_pad_set_active (mysink2, TRUE);
|
|
|
|
|
|
|
|
GST_DEBUG ("Creating mysrc");
|
2008-10-14 12:34:56 +00:00
|
|
|
mysrc = gst_pad_new ("mysrc", GST_PAD_SRC);
|
2011-06-06 10:23:04 +00:00
|
|
|
gst_pad_set_active (mysrc, TRUE);
|
2008-10-14 12:34:56 +00:00
|
|
|
|
2013-05-09 11:32:07 +00:00
|
|
|
gst_segment_init (&segment, GST_FORMAT_BYTES);
|
|
|
|
gst_pad_push_event (mysrc, gst_event_new_stream_start ("test"));
|
|
|
|
gst_pad_set_caps (mysrc, caps);
|
|
|
|
gst_pad_push_event (mysrc, gst_event_new_segment (&segment));
|
2008-10-14 12:34:56 +00:00
|
|
|
|
|
|
|
fail_unless (gst_pad_link (mysrc, teesink) == GST_PAD_LINK_OK);
|
|
|
|
fail_unless (gst_pad_link (teesrc1, mysink1) == GST_PAD_LINK_OK);
|
|
|
|
fail_unless (gst_pad_link (teesrc2, mysink2) == GST_PAD_LINK_OK);
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (tee,
|
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new ();
|
2011-05-09 14:21:28 +00:00
|
|
|
#if 0
|
2011-05-05 08:37:19 +00:00
|
|
|
gst_buffer_set_caps (buffer, caps);
|
2011-05-09 14:21:28 +00:00
|
|
|
#endif
|
2008-10-14 12:34:56 +00:00
|
|
|
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Try to push a buffer");
|
2008-10-14 12:34:56 +00:00
|
|
|
/* First check if everything works in normal state */
|
|
|
|
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK);
|
|
|
|
|
|
|
|
/* One pad being in wrong state must result in wrong state */
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Trying to push with mysink2 disabled");
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_active (mysink2, FALSE);
|
|
|
|
fail_unless (gst_pad_push (mysrc,
|
2012-02-08 14:16:46 +00:00
|
|
|
gst_buffer_ref (buffer)) == GST_FLOW_FLUSHING);
|
2008-10-14 12:34:56 +00:00
|
|
|
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Trying to push with mysink2 disabled");
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_active (mysink1, FALSE);
|
|
|
|
gst_pad_set_active (mysink2, TRUE);
|
|
|
|
fail_unless (gst_pad_push (mysrc,
|
2012-02-08 14:16:46 +00:00
|
|
|
gst_buffer_ref (buffer)) == GST_FLOW_FLUSHING);
|
2008-10-14 12:34:56 +00:00
|
|
|
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Trying to push with mysink2 and mysink1 disabled");
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_active (mysink2, FALSE);
|
|
|
|
fail_unless (gst_pad_push (mysrc,
|
2012-02-08 14:16:46 +00:00
|
|
|
gst_buffer_ref (buffer)) == GST_FLOW_FLUSHING);
|
2008-10-14 12:34:56 +00:00
|
|
|
|
|
|
|
/* Test if everything still works in normal state */
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Reactivate both pads and try pushing");
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_active (mysink1, TRUE);
|
|
|
|
gst_pad_set_active (mysink2, TRUE);
|
|
|
|
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK);
|
|
|
|
|
|
|
|
/* One unlinked pad must return OK, two unlinked pads must return NOT_LINKED */
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Pushing with mysink1 unlinked");
|
2008-10-14 12:34:56 +00:00
|
|
|
fail_unless (gst_pad_unlink (teesrc1, mysink1) == TRUE);
|
|
|
|
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK);
|
|
|
|
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Pushing with mysink2 unlinked");
|
2008-10-14 12:34:56 +00:00
|
|
|
fail_unless (gst_pad_link (teesrc1, mysink1) == GST_PAD_LINK_OK);
|
|
|
|
fail_unless (gst_pad_unlink (teesrc2, mysink2) == TRUE);
|
|
|
|
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK);
|
|
|
|
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Pushing with mysink1 AND mysink2 unlinked");
|
2008-10-14 12:34:56 +00:00
|
|
|
fail_unless (gst_pad_unlink (teesrc1, mysink1) == TRUE);
|
|
|
|
fail_unless (gst_pad_push (mysrc,
|
|
|
|
gst_buffer_ref (buffer)) == GST_FLOW_NOT_LINKED);
|
|
|
|
|
|
|
|
/* Test if everything still works in normal state */
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Relink both pads and try pushing");
|
2008-10-14 12:34:56 +00:00
|
|
|
fail_unless (gst_pad_link (teesrc1, mysink1) == GST_PAD_LINK_OK);
|
|
|
|
fail_unless (gst_pad_link (teesrc2, mysink2) == GST_PAD_LINK_OK);
|
|
|
|
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK);
|
|
|
|
|
|
|
|
/* One pad returning ERROR should result in ERROR */
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Pushing with mysink1 returning GST_FLOW_ERROR");
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_chain_function (mysink1, _fake_chain_error);
|
|
|
|
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_ERROR);
|
|
|
|
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Pushing with mysink2 returning GST_FLOW_ERROR");
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_chain_function (mysink1, _fake_chain);
|
|
|
|
gst_pad_set_chain_function (mysink2, _fake_chain_error);
|
|
|
|
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_ERROR);
|
|
|
|
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Pushing with mysink1 AND mysink2 returning GST_FLOW_ERROR");
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_chain_function (mysink1, _fake_chain_error);
|
|
|
|
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_ERROR);
|
|
|
|
|
|
|
|
/* And now everything still needs to work */
|
2011-06-06 10:23:04 +00:00
|
|
|
GST_DEBUG ("Try pushing with everything ok");
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_chain_function (mysink1, _fake_chain);
|
|
|
|
gst_pad_set_chain_function (mysink2, _fake_chain);
|
|
|
|
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK);
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (tee,
|
|
|
|
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS);
|
|
|
|
|
|
|
|
fail_unless (gst_pad_unlink (mysrc, teesink) == TRUE);
|
|
|
|
fail_unless (gst_pad_unlink (teesrc1, mysink1) == TRUE);
|
|
|
|
fail_unless (gst_pad_unlink (teesrc2, mysink2) == TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
gst_object_unref (teesink);
|
|
|
|
gst_object_unref (teesrc1);
|
|
|
|
gst_object_unref (teesrc2);
|
|
|
|
gst_element_release_request_pad (tee, teesrc1);
|
|
|
|
gst_element_release_request_pad (tee, teesrc2);
|
|
|
|
gst_object_unref (tee);
|
|
|
|
|
|
|
|
gst_object_unref (mysink1);
|
|
|
|
gst_object_unref (mysink2);
|
|
|
|
gst_object_unref (mysrc);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2014-01-14 15:47:38 +00:00
|
|
|
GST_START_TEST (test_request_pads)
|
|
|
|
{
|
|
|
|
GstElement *tee;
|
|
|
|
GstPad *srcpad1, *srcpad2, *srcpad3, *srcpad4;
|
|
|
|
|
|
|
|
tee = gst_check_setup_element ("tee");
|
|
|
|
|
|
|
|
srcpad1 = gst_element_get_request_pad (tee, "src_%u");
|
|
|
|
fail_unless (srcpad1 != NULL);
|
|
|
|
fail_unless_equals_string (GST_OBJECT_NAME (srcpad1), "src_0");
|
|
|
|
srcpad2 = gst_element_get_request_pad (tee, "src_100");
|
|
|
|
fail_unless (srcpad2 != NULL);
|
|
|
|
fail_unless_equals_string (GST_OBJECT_NAME (srcpad2), "src_100");
|
|
|
|
srcpad3 = gst_element_get_request_pad (tee, "src_10");
|
|
|
|
fail_unless (srcpad3 != NULL);
|
|
|
|
fail_unless_equals_string (GST_OBJECT_NAME (srcpad3), "src_10");
|
|
|
|
srcpad4 = gst_element_get_request_pad (tee, "src_%u");
|
|
|
|
fail_unless (srcpad4 != NULL);
|
|
|
|
|
|
|
|
gst_object_unref (srcpad1);
|
|
|
|
gst_object_unref (srcpad2);
|
|
|
|
gst_object_unref (srcpad3);
|
|
|
|
gst_object_unref (srcpad4);
|
|
|
|
gst_object_unref (tee);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2015-03-19 09:36:11 +00:00
|
|
|
GST_START_TEST (test_allow_not_linked)
|
|
|
|
{
|
|
|
|
GstElement *tee;
|
|
|
|
GstPad *src1, *src2;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstCaps *caps;
|
|
|
|
GstSegment segment;
|
|
|
|
|
|
|
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty_simple ("test/test");
|
|
|
|
|
|
|
|
tee = gst_check_setup_element ("tee");
|
|
|
|
fail_unless (tee);
|
|
|
|
g_object_set (tee, "allow-not-linked", TRUE, NULL);
|
|
|
|
|
|
|
|
srcpad = gst_check_setup_src_pad (tee, &srctemplate);
|
|
|
|
gst_pad_set_active (srcpad, TRUE);
|
|
|
|
|
|
|
|
gst_pad_push_event (srcpad, gst_event_new_stream_start ("test"));
|
|
|
|
gst_segment_init (&segment, GST_FORMAT_BYTES);
|
|
|
|
gst_pad_push_event (srcpad, gst_event_new_stream_start ("test"));
|
|
|
|
gst_pad_set_caps (srcpad, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_pad_push_event (srcpad, gst_event_new_segment (&segment));
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (tee,
|
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new ();
|
|
|
|
fail_unless (buffer);
|
|
|
|
|
|
|
|
fail_unless (gst_pad_push (srcpad, gst_buffer_ref (buffer)) == GST_FLOW_OK);
|
|
|
|
|
|
|
|
src1 = gst_element_get_request_pad (tee, "src_%u");
|
|
|
|
|
|
|
|
fail_unless (gst_pad_push (srcpad, gst_buffer_ref (buffer)) == GST_FLOW_OK);
|
|
|
|
|
|
|
|
src2 = gst_element_get_request_pad (tee, "src_%u");
|
|
|
|
|
|
|
|
fail_unless (gst_pad_push (srcpad, gst_buffer_ref (buffer)) == GST_FLOW_OK);
|
|
|
|
|
|
|
|
g_object_set (tee, "allow-not-linked", FALSE, NULL);
|
|
|
|
|
|
|
|
fail_unless (gst_pad_push (srcpad,
|
|
|
|
gst_buffer_ref (buffer)) == GST_FLOW_NOT_LINKED);
|
|
|
|
|
|
|
|
gst_element_release_request_pad (tee, src1);
|
|
|
|
|
|
|
|
fail_unless (gst_pad_push (srcpad,
|
|
|
|
gst_buffer_ref (buffer)) == GST_FLOW_NOT_LINKED);
|
|
|
|
|
|
|
|
gst_element_release_request_pad (tee, src2);
|
|
|
|
g_object_unref (src1);
|
|
|
|
g_object_unref (src2);
|
|
|
|
|
|
|
|
fail_unless (gst_pad_push (srcpad,
|
|
|
|
gst_buffer_ref (buffer)) == GST_FLOW_NOT_LINKED);
|
|
|
|
|
|
|
|
gst_pad_set_active (srcpad, FALSE);
|
|
|
|
gst_check_teardown_src_pad (tee);
|
|
|
|
gst_check_teardown_element (tee);
|
|
|
|
|
|
|
|
fail_if (buffer->mini_object.refcount != 1);
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2017-10-02 14:26:33 +00:00
|
|
|
static gboolean
|
2017-10-02 18:11:19 +00:00
|
|
|
allocation_query_empty (GstPad * pad, GstObject * parent, GstQuery * query)
|
2017-10-02 14:26:33 +00:00
|
|
|
{
|
|
|
|
if (GST_QUERY_TYPE (query) != GST_QUERY_ALLOCATION)
|
|
|
|
return gst_pad_query_default (pad, parent, query);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-09-05 19:45:33 +00:00
|
|
|
static gboolean
|
|
|
|
allocation_query1 (GstPad * pad, GstObject * parent, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstAllocationParams param = { 0, 15, 1, 1 };
|
|
|
|
|
|
|
|
if (GST_QUERY_TYPE (query) != GST_QUERY_ALLOCATION)
|
|
|
|
return gst_pad_query_default (pad, parent, query);
|
|
|
|
|
|
|
|
gst_query_add_allocation_pool (query, NULL, 128, 2, 10);
|
|
|
|
gst_query_add_allocation_param (query, NULL, ¶m);
|
|
|
|
gst_query_add_allocation_meta (query, GST_PARENT_BUFFER_META_API_TYPE, NULL);
|
|
|
|
gst_query_add_allocation_meta (query, GST_REFERENCE_TIMESTAMP_META_API_TYPE,
|
|
|
|
NULL);
|
|
|
|
gst_query_add_allocation_meta (query, GST_PROTECTION_META_API_TYPE, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
allocation_query2 (GstPad * pad, GstObject * parent, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstAllocationParams param = { 0, 7, 2, 1 };
|
|
|
|
|
|
|
|
if (GST_QUERY_TYPE (query) != GST_QUERY_ALLOCATION)
|
|
|
|
return gst_pad_query_default (pad, parent, query);
|
|
|
|
|
|
|
|
gst_query_add_allocation_pool (query, NULL, 129, 1, 15);
|
|
|
|
gst_query_add_allocation_param (query, NULL, ¶m);
|
|
|
|
gst_query_add_allocation_meta (query, GST_PARENT_BUFFER_META_API_TYPE, NULL);
|
|
|
|
gst_query_add_allocation_meta (query, GST_REFERENCE_TIMESTAMP_META_API_TYPE,
|
|
|
|
NULL);
|
|
|
|
gst_query_add_allocation_meta (query, GST_PROTECTION_META_API_TYPE, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
allocation_query3 (GstPad * pad, GstObject * parent, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
GstAllocationParams param = { 0, 7, 1, 2 };
|
|
|
|
|
|
|
|
if (GST_QUERY_TYPE (query) != GST_QUERY_ALLOCATION)
|
|
|
|
return gst_pad_query_default (pad, parent, query);
|
|
|
|
|
|
|
|
gst_query_add_allocation_pool (query, NULL, 130, 1, 20);
|
|
|
|
gst_query_add_allocation_param (query, NULL, ¶m);
|
|
|
|
gst_query_add_allocation_meta (query, GST_PARENT_BUFFER_META_API_TYPE, NULL);
|
|
|
|
s = gst_structure_new_empty ("test/test");
|
|
|
|
gst_query_add_allocation_meta (query, GST_PROTECTION_META_API_TYPE, s);
|
|
|
|
gst_structure_free (s);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
allocation_query_fail (GstPad * pad, GstObject * parent, GstQuery * query)
|
|
|
|
{
|
|
|
|
if (GST_QUERY_TYPE (query) != GST_QUERY_ALLOCATION)
|
|
|
|
return gst_pad_query_default (pad, parent, query);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-02 14:25:00 +00:00
|
|
|
static void
|
|
|
|
add_sink_pad_and_setup_query_func (GstElement * tee,
|
|
|
|
GstPadQueryFunction query_func)
|
|
|
|
{
|
|
|
|
GstPad *sink;
|
|
|
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
sink = gst_check_setup_sink_pad_by_name (tee, &sinktemplate, "src_%u");
|
|
|
|
fail_unless (sink != NULL);
|
|
|
|
gst_pad_set_query_function (sink, query_func);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_START_TEST (test_allocation_query_aggregation)
|
2017-09-05 19:45:33 +00:00
|
|
|
{
|
|
|
|
GstElement *tee;
|
2017-10-02 17:35:52 +00:00
|
|
|
GstPad *sinkpad;
|
2017-09-05 19:45:33 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
GstQuery *query;
|
|
|
|
guint size, min, max;
|
|
|
|
GstAllocationParams param;
|
|
|
|
|
|
|
|
tee = gst_check_setup_element ("tee");
|
|
|
|
fail_unless (tee);
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_static_pad (tee, "sink");
|
2017-10-02 14:25:00 +00:00
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query1);
|
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query2);
|
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query3);
|
2017-09-05 19:45:33 +00:00
|
|
|
|
2017-10-02 14:25:00 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("test/test");
|
2017-09-05 19:45:33 +00:00
|
|
|
query = gst_query_new_allocation (caps, TRUE);
|
|
|
|
fail_unless (gst_pad_query (sinkpad, query));
|
|
|
|
|
2017-10-02 14:25:00 +00:00
|
|
|
ck_assert_int_eq (gst_query_get_n_allocation_pools (query), 1);
|
2017-09-05 19:45:33 +00:00
|
|
|
gst_query_parse_nth_allocation_pool (query, 0, NULL, &size, &min, &max);
|
|
|
|
fail_unless (size == 130);
|
2017-09-05 19:57:51 +00:00
|
|
|
/* The tee will allocate one more buffer when multiplexing */
|
|
|
|
fail_unless (min == 2 + 1);
|
2017-09-05 19:45:33 +00:00
|
|
|
fail_unless (max == 0);
|
|
|
|
|
|
|
|
fail_unless (gst_query_get_n_allocation_params (query), 1);
|
|
|
|
gst_query_parse_nth_allocation_param (query, 0, NULL, ¶m);
|
|
|
|
fail_unless (param.align == 15);
|
|
|
|
fail_unless (param.prefix == 2);
|
|
|
|
fail_unless (param.padding == 2);
|
|
|
|
|
|
|
|
fail_unless (gst_query_get_n_allocation_metas (query), 1);
|
|
|
|
fail_unless (gst_query_parse_nth_allocation_meta (query, 0, NULL) ==
|
|
|
|
GST_PARENT_BUFFER_META_API_TYPE);
|
|
|
|
|
2017-10-02 14:25:00 +00:00
|
|
|
gst_caps_unref (caps);
|
2017-09-05 19:45:33 +00:00
|
|
|
gst_query_unref (query);
|
2017-10-02 14:25:00 +00:00
|
|
|
gst_check_teardown_pad_by_name (tee, "src_0");
|
|
|
|
gst_check_teardown_pad_by_name (tee, "src_1");
|
|
|
|
gst_check_teardown_pad_by_name (tee, "src_2");
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_check_teardown_element (tee);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
|
|
|
|
GST_START_TEST (test_allocation_query_allow_not_linked)
|
|
|
|
{
|
|
|
|
GstElement *tee;
|
2017-10-02 17:35:52 +00:00
|
|
|
GstPad *sinkpad, *srcpad;
|
2017-10-02 14:25:00 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
GstQuery *query;
|
|
|
|
|
|
|
|
tee = gst_check_setup_element ("tee");
|
|
|
|
fail_unless (tee);
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_static_pad (tee, "sink");
|
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query1);
|
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query2);
|
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query3);
|
2017-10-02 17:35:52 +00:00
|
|
|
/* This unlinked pad is what will make a difference between having
|
|
|
|
* allow-not-linked set or not */
|
|
|
|
srcpad = gst_element_get_request_pad (tee, "src_%u");
|
2017-10-02 14:25:00 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("test/test");
|
2017-10-02 17:35:52 +00:00
|
|
|
|
|
|
|
/* Without allow-not-linked the query should fail */
|
|
|
|
query = gst_query_new_allocation (caps, TRUE);
|
|
|
|
fail_if (gst_pad_query (sinkpad, query));
|
|
|
|
|
|
|
|
/* While with allow-not-linked it should succeed (ignoring that pad) */
|
|
|
|
g_object_set (tee, "allow-not-linked", TRUE, NULL);
|
|
|
|
gst_query_unref (query);
|
2017-09-05 19:45:33 +00:00
|
|
|
query = gst_query_new_allocation (caps, TRUE);
|
|
|
|
fail_unless (gst_pad_query (sinkpad, query));
|
|
|
|
|
2017-10-02 14:25:00 +00:00
|
|
|
gst_caps_unref (caps);
|
2017-09-05 19:45:33 +00:00
|
|
|
gst_query_unref (query);
|
2017-10-02 14:25:00 +00:00
|
|
|
gst_check_teardown_pad_by_name (tee, "src_0");
|
|
|
|
gst_check_teardown_pad_by_name (tee, "src_1");
|
|
|
|
gst_check_teardown_pad_by_name (tee, "src_2");
|
2017-10-02 17:35:52 +00:00
|
|
|
gst_element_release_request_pad (tee, srcpad);
|
|
|
|
gst_object_unref (srcpad);
|
2017-10-02 14:25:00 +00:00
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_check_teardown_element (tee);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
|
|
|
|
GST_START_TEST (test_allocation_query_failure)
|
|
|
|
{
|
|
|
|
GstElement *tee;
|
|
|
|
GstPad *sinkpad;
|
|
|
|
GstCaps *caps;
|
|
|
|
GstQuery *query;
|
|
|
|
|
|
|
|
tee = gst_check_setup_element ("tee");
|
|
|
|
fail_unless (tee);
|
|
|
|
g_object_set (tee, "allow-not-linked", TRUE, NULL);
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_static_pad (tee, "sink");
|
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query1);
|
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query2);
|
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query_fail);
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty_simple ("test/test");
|
2017-09-05 19:45:33 +00:00
|
|
|
query = gst_query_new_allocation (caps, TRUE);
|
|
|
|
fail_if (gst_pad_query (sinkpad, query));
|
|
|
|
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_query_unref (query);
|
|
|
|
gst_check_teardown_pad_by_name (tee, "src_0");
|
|
|
|
gst_check_teardown_pad_by_name (tee, "src_1");
|
|
|
|
gst_check_teardown_pad_by_name (tee, "src_2");
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_check_teardown_element (tee);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2017-10-02 14:26:33 +00:00
|
|
|
|
2017-10-02 18:11:19 +00:00
|
|
|
GST_START_TEST (test_allocation_query_empty)
|
2017-10-02 14:26:33 +00:00
|
|
|
{
|
|
|
|
GstElement *tee;
|
|
|
|
GstPad *sinkpad;
|
|
|
|
GstCaps *caps;
|
|
|
|
GstQuery *query;
|
|
|
|
|
|
|
|
tee = gst_check_setup_element ("tee");
|
|
|
|
fail_unless (tee);
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_static_pad (tee, "sink");
|
2017-10-02 18:11:19 +00:00
|
|
|
add_sink_pad_and_setup_query_func (tee, allocation_query_empty);
|
2017-10-02 14:26:33 +00:00
|
|
|
|
|
|
|
caps = gst_caps_new_empty_simple ("test/test");
|
|
|
|
|
|
|
|
query = gst_query_new_allocation (caps, TRUE);
|
|
|
|
fail_unless (gst_pad_query (sinkpad, query));
|
|
|
|
|
|
|
|
ck_assert_int_eq (gst_query_get_n_allocation_pools (query), 0);
|
2017-10-02 18:11:19 +00:00
|
|
|
ck_assert_int_eq (gst_query_get_n_allocation_params (query), 0);
|
2017-10-02 14:26:33 +00:00
|
|
|
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
gst_query_unref (query);
|
|
|
|
gst_check_teardown_pad_by_name (tee, "src_0");
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_check_teardown_element (tee);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static Suite *
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
tee_suite (void)
|
|
|
|
{
|
|
|
|
Suite *s = suite_create ("tee");
|
|
|
|
TCase *tc_chain = tcase_create ("general");
|
|
|
|
|
2009-01-31 21:31:48 +00:00
|
|
|
/* Set the timeout to a much larger time - 3 minutes */
|
|
|
|
tcase_set_timeout (tc_chain, 180);
|
|
|
|
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
suite_add_tcase (s, tc_chain);
|
|
|
|
tcase_add_test (tc_chain, test_num_buffers);
|
|
|
|
tcase_add_test (tc_chain, test_stress);
|
plugins/elements/gsttee.*: Protect pad_alloc with a new lock so that we can be sure that nothing is performing a pad_...
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås <ole.andre.ravnas at tandberg com>
* plugins/elements/gsttee.c: (gst_tee_finalize), (gst_tee_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc):
* plugins/elements/gsttee.h:
Protect pad_alloc with a new lock so that we can be sure that nothing is
performing a pad_alloc when removing the pad. Fixes #547835.
* tests/check/elements/tee.c: (buffer_alloc_harness_setup),
(buffer_alloc_harness_teardown), (app_thread_func),
(final_sinkpad_bufferalloc), (GST_START_TEST), (tee_suite):
Added testcase for shutdown race.
2008-08-15 17:01:07 +00:00
|
|
|
tcase_add_test (tc_chain, test_release_while_buffer_alloc);
|
|
|
|
tcase_add_test (tc_chain, test_release_while_second_buffer_alloc);
|
2008-09-01 10:42:04 +00:00
|
|
|
tcase_add_test (tc_chain, test_internal_links);
|
2008-10-14 12:34:56 +00:00
|
|
|
tcase_add_test (tc_chain, test_flow_aggregation);
|
2014-01-14 15:47:38 +00:00
|
|
|
tcase_add_test (tc_chain, test_request_pads);
|
2015-03-19 09:36:11 +00:00
|
|
|
tcase_add_test (tc_chain, test_allow_not_linked);
|
2017-10-02 14:25:00 +00:00
|
|
|
tcase_add_test (tc_chain, test_allocation_query_aggregation);
|
|
|
|
tcase_add_test (tc_chain, test_allocation_query_allow_not_linked);
|
|
|
|
tcase_add_test (tc_chain, test_allocation_query_failure);
|
2017-10-02 18:11:19 +00:00
|
|
|
tcase_add_test (tc_chain, test_allocation_query_empty);
|
plugins/elements/gsttee.c: Be a lot smarter when deciding what srcpad to use for proxying the buffer_alloc. Also hand...
Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_request_new_pad), (gst_tee_release_pad),
(gst_tee_find_buffer_alloc), (gst_tee_buffer_alloc),
(gst_tee_do_push), (clear_pads), (gst_tee_handle_buffer),
(gst_tee_chain):
Be a lot smarter when deciding what srcpad to use for proxying
the buffer_alloc. Also handle pad added/removed when doing so.
Fixes #357959.
Keep track of what pads we already pushed on in case we have pads
added/removed while pushing. Fixes #374639
* tests/check/Makefile.am:
* tests/check/elements/tee.c: (handoff), (GST_START_TEST),
(tee_suite):
Added unit test for pad resync.
2007-07-03 16:26:29 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_CHECK_MAIN (tee);
|