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
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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;
|
|
|
|
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);
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_caps (mysink1, caps);
|
2011-06-06 10:23:04 +00:00
|
|
|
|
|
|
|
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);
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_caps (mysink2, caps);
|
2011-06-06 10:23:04 +00:00
|
|
|
|
|
|
|
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
|
|
|
gst_pad_set_caps (mysrc, caps);
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
2011-06-06 10:23:04 +00:00
|
|
|
gst_pad_set_caps (mysink2, caps);
|
2008-10-14 12:34:56 +00:00
|
|
|
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);
|
2011-06-06 10:23:04 +00:00
|
|
|
gst_pad_set_caps (mysink1, caps);
|
2008-10-14 12:34:56 +00:00
|
|
|
gst_pad_set_active (mysink2, TRUE);
|
2011-06-06 10:23:04 +00:00
|
|
|
gst_pad_set_caps (mysink2, caps);
|
2008-10-14 12:34:56 +00:00
|
|
|
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;
|
|
|
|
|
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);
|
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);
|