From 9f3b0b8f3aa4e983db5962423ada7945b4f59a35 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 21 Mar 2007 11:52:04 +0000 Subject: [PATCH] gst/gstbin.c: Prepare for release where we warn against possible app breakage in the case of live pipelines along wit... Original commit message from CVS: * gst/gstbin.c: (gst_bin_get_type), (gst_bin_element_set_state): Prepare for release where we warn against possible app breakage in the case of live pipelines along with an env var to enable/disable live preroll mode (GST_COMPAT=[no-]live-preroll). --- ChangeLog | 7 +++++++ gst/gstbin.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ec084a5e1b..ad6eebf8d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-03-21 Wim Taymans + + * gst/gstbin.c: (gst_bin_get_type), (gst_bin_element_set_state): + Prepare for release where we warn against possible app breakage in the + case of live pipelines along with an env var to enable/disable live + preroll mode (GST_COMPAT=[no-]live-preroll). + 2007-03-20 Zaheer Abbas Merali * plugins/elements/gstidentity.c (gst_identity_check_imperfect_offset): diff --git a/gst/gstbin.c b/gst/gstbin.c index 9eab23aaf7..78a6d15da6 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -176,6 +176,16 @@ * their duration when it changes so we return inaccurate values. */ #undef DURATION_CACHING +/* latency is by default disabled for non CVS for now. + * live-preroll and no-live-preroll in the environment var GST_COMPAT + * to enables or disable it respectively. + */ +#if GST_VERSION_NANO == 1 +static gboolean enable_latency = TRUE; +#else +static gboolean enable_latency = FALSE; +#endif + GST_DEBUG_CATEGORY_STATIC (bin_debug); #define GST_CAT_DEFAULT bin_debug @@ -253,6 +263,7 @@ GType gst_bin_get_type (void) { static GType gst_bin_type = 0; + const gchar *compat; if (G_UNLIKELY (gst_bin_type == 0)) { static const GTypeInfo bin_info = { @@ -281,6 +292,15 @@ gst_bin_get_type (void) GST_DEBUG_CATEGORY_INIT (bin_debug, "bin", GST_DEBUG_BOLD, "debugging info for the 'bin' container element"); + + /* compatibility stuff */ + compat = g_getenv ("GST_COMPAT"); + if (compat != NULL) { + if (strstr (compat, "no-live-preroll")) + enable_latency = FALSE; + else if (strstr (compat, "live-preroll")) + enable_latency = TRUE; + } } return gst_bin_type; } @@ -1824,12 +1844,25 @@ gst_bin_element_set_state (GstBin * bin, GstElement * element, GstMessage *message = GST_MESSAGE_CAST (found->data); GstObject *src = GST_MESSAGE_SRC (message); + GST_DEBUG_OBJECT (element, "element message %p, %s async busy", message, GST_ELEMENT_NAME (src)); /* only wait for upward state changes */ - if (next > current) + if (next > current) { + /* We found an async element check if we can force its state to change or + * if we have to wait for it to preroll. */ + if (G_UNLIKELY (!enable_latency)) { + g_warning ("Future versions of GStreamer will wait for element \"%s\"\n" + "\tto preroll in order to perform correct latency calculations.\n" + "\tPlease verify that the application continues to work correctly by\n" + "\tsetting the environment variable GST_COMPAT to a value containing\n" + "\tthe string 'live-preroll'.", GST_ELEMENT_NAME (element)); + goto no_latency; + } goto was_busy; + } } +no_latency: GST_OBJECT_UNLOCK (bin); GST_DEBUG_OBJECT (bin,