Merge branch 'master' into 0.11

This commit is contained in:
Sebastian Dröge 2011-04-06 14:20:59 +02:00
commit 08b98cc7e9
7 changed files with 114 additions and 7 deletions

2
common

@ -1 +1 @@
Subproject commit 1ccbe098d6379612fcef09f4000da23585af980a
Subproject commit c3cafe123f3a363d337a29ad32fdd6d3631f52c0

View file

@ -51,6 +51,9 @@ extern const char g_log_domain_gstreamer[];
/* for the pad cache */
#include "gstpad.h"
/* for GstBus */
#include "gstbus.h"
G_BEGIN_DECLS
/* used by gstparse.c and grammar.y */
@ -124,7 +127,6 @@ gboolean priv_gst_structure_append_to_gstring (const GstStructure * structure,
gboolean gst_registry_binary_read_cache (GstRegistry * registry, const char *location);
gboolean gst_registry_binary_write_cache (GstRegistry * registry, const char *location);
/* used in gstvalue.c and gststructure.c */
#define GST_ASCII_IS_STRING(c) (g_ascii_isalnum((c)) || ((c) == '_') || \
((c) == '-') || ((c) == '+') || ((c) == '/') || ((c) == ':') || \
@ -138,6 +140,11 @@ gint priv_gst_date_time_compare (gconstpointer dt1, gconstpointer dt2);
extern gboolean _gst_disable_registry_cache;
#endif
/* Secret API used by GstBin to set the bus in child bus mode
* without sockets and everything. See bug #646624.
*/
void _priv_gst_bus_set_child_mode (GstBus * bus);
/* provide inline gst_g_value_get_foo_unchecked(), used in gststructure.c */
#define DEFINE_INLINE_G_VALUE_GET_UNCHECKED(ret_type,name_type,v_field) \
static inline ret_type \

View file

@ -518,6 +518,7 @@ gst_bin_init (GstBin * bin, GstBinClass * klass)
GST_DEBUG_OBJECT (bin, "using bus %" GST_PTR_FORMAT " to listen to children",
bus);
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bin_bus_handler, bin);
_priv_gst_bus_set_child_mode (bus);
bin->priv = GST_BIN_GET_PRIVATE (bin);
bin->priv->asynchandling = DEFAULT_ASYNC_HANDLING;

View file

@ -191,7 +191,9 @@ gst_bus_dispose (GObject * object)
g_cond_free (bus->priv->queue_cond);
bus->priv->queue_cond = NULL;
gst_poll_free (bus->priv->poll);
if (bus->priv->poll)
gst_poll_free (bus->priv->poll);
bus->priv->poll = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
@ -273,7 +275,8 @@ gst_bus_post (GstBus * bus, GstMessage * message)
/* pass the message to the async queue, refcount passed in the queue */
GST_DEBUG_OBJECT (bus, "[msg %p] pushing on async queue", message);
gst_atomic_queue_push (bus->queue, message);
gst_poll_write_control (bus->priv->poll);
if (bus->priv->poll)
gst_poll_write_control (bus->priv->poll);
GST_DEBUG_OBJECT (bus, "[msg %p] pushed on async queue", message);
break;
@ -295,7 +298,8 @@ gst_bus_post (GstBus * bus, GstMessage * message)
g_mutex_lock (lock);
gst_atomic_queue_push (bus->queue, message);
gst_poll_write_control (bus->priv->poll);
if (bus->priv->poll)
gst_poll_write_control (bus->priv->poll);
/* now block till the message is freed */
g_cond_wait (cond, lock);
@ -415,6 +419,7 @@ gst_bus_timed_pop_filtered (GstBus * bus, GstClockTime timeout,
g_return_val_if_fail (GST_IS_BUS (bus), NULL);
g_return_val_if_fail (types != 0, NULL);
g_return_val_if_fail (bus->priv->poll != NULL, NULL);
g_mutex_lock (bus->queue_lock);
@ -737,6 +742,7 @@ gst_bus_create_watch (GstBus * bus)
GstBusSource *source;
g_return_val_if_fail (GST_IS_BUS (bus), NULL);
g_return_val_if_fail (bus->priv->poll != NULL, NULL);
source = (GstBusSource *) g_source_new (&gst_bus_source_funcs,
sizeof (GstBusSource));
@ -1251,3 +1257,14 @@ error:
return;
}
}
/* Secret API used by GstBin to set the bus in child bus mode
* without sockets and everything. See bug #646624.
*/
void
_priv_gst_bus_set_child_mode (GstBus * bus)
{
if (bus->priv->poll)
gst_poll_free (bus->priv->poll);
bus->priv->poll = NULL;
}

View file

@ -1710,6 +1710,8 @@ gst_structure_get_abbrs (gint * n_abbrs)
,
{"structure", GST_TYPE_STRUCTURE}
,
{"date", GST_TYPE_DATE}
,
{"datetime", GST_TYPE_DATE_TIME}
};
_num = G_N_ELEMENTS (dyn_abbrs);

View file

@ -1070,6 +1070,85 @@ GST_START_TEST (test_state_failure_remove)
GST_END_TEST;
GST_START_TEST (test_many_bins)
{
GstStateChangeReturn ret;
GstElement *src, *sink, *pipeline, *last_bin = NULL;
gint i;
#define NUM_BINS 2000
pipeline = gst_pipeline_new (NULL);
fail_unless (pipeline != NULL, "Could not create pipeline");
src = gst_element_factory_make ("fakesrc", "fakesrc");
fail_unless (src != NULL, "Could not create fakesrc");
g_object_set (src, "num-buffers", 3, NULL);
sink = gst_element_factory_make ("fakesink", "fakesink");
fail_unless (sink != NULL, "Could not create fakesink");
gst_bin_add (GST_BIN (pipeline), src);
gst_bin_add (GST_BIN (pipeline), sink);
for (i = 0; i < NUM_BINS; ++i) {
GstElement *bin, *identity;
GstPad *srcpad, *sinkpad;
bin = gst_bin_new (NULL);
fail_unless (bin != NULL, "Could not create bin %d", i);
identity = gst_element_factory_make ("identity", "identity");
fail_unless (identity != NULL, "Could not create identity %d", i);
g_object_set (identity, "silent", TRUE, NULL);
gst_bin_add (GST_BIN (bin), identity);
sinkpad = gst_element_get_static_pad (identity, "sink");
srcpad = gst_element_get_static_pad (identity, "src");
gst_element_add_pad (bin, gst_ghost_pad_new ("sink", sinkpad));
gst_element_add_pad (bin, gst_ghost_pad_new ("src", srcpad));
gst_object_unref (sinkpad);
gst_object_unref (srcpad);
gst_bin_add (GST_BIN (pipeline), bin);
if (last_bin == NULL) {
srcpad = gst_element_get_static_pad (src, "src");
} else {
srcpad = gst_element_get_static_pad (last_bin, "src");
}
sinkpad = gst_element_get_static_pad (bin, "sink");
gst_pad_link_full (srcpad, sinkpad, GST_PAD_LINK_CHECK_NOTHING);
gst_object_unref (sinkpad);
gst_object_unref (srcpad);
last_bin = bin;
/* insert some queues to limit the number of function calls in a row */
if ((i % 100) == 0) {
GstElement *q = gst_element_factory_make ("queue", NULL);
GST_LOG ("bin #%d, inserting queue", i);
gst_bin_add (GST_BIN (pipeline), q);
fail_unless (gst_element_link (last_bin, q));
last_bin = q;
}
}
fail_unless (gst_element_link (last_bin, sink));
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "did not get state change async");
ret = gst_element_get_state (pipeline, NULL, NULL, 5 * GST_SECOND);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS,
"did not get state change success");
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
}
GST_END_TEST;
static Suite *
gst_bin_suite (void)
{
@ -1093,6 +1172,7 @@ gst_bin_suite (void)
tcase_add_test (tc_chain, test_iterate_sorted);
tcase_add_test (tc_chain, test_link_structure_change);
tcase_add_test (tc_chain, test_state_failure_remove);
tcase_add_test (tc_chain, test_many_bins);
return s;
}

View file

@ -2001,7 +2001,7 @@ GST_START_TEST (test_date)
s = NULL;
fail_unless (g_str_equal (str,
"media/x-type, SOME_DATE_TAG=(GstDate)2005-09-22;"));
"media/x-type, SOME_DATE_TAG=(date)2005-09-22;"));
s = gst_structure_from_string (str, NULL);
g_free (str);
@ -2025,7 +2025,7 @@ GST_START_TEST (test_date)
s = NULL;
fail_unless (g_str_equal (str,
"media/x-type, SOME_DATE_TAG=(GstDate)2005-09-22;"));
"media/x-type, SOME_DATE_TAG=(date)2005-09-22;"));
g_free (str);
str = NULL;
}