gst/gstpipeline.c (gst_pipeline_change_state): Interpret play-timeout==0 to mean no timeout at all. In that case, don...

Original commit message from CVS:
2005-08-17  Andy Wingo  <wingo@pobox.com>

* gst/gstpipeline.c (gst_pipeline_change_state): Interpret
play-timeout==0 to mean no timeout at all. In that case, don't
bother with a get_state or a warning, just return directly, even
if it's ASYNC.
This commit is contained in:
Andy Wingo 2005-08-17 16:57:01 +00:00
parent c5e2202f20
commit de7347bda6
2 changed files with 21 additions and 10 deletions

View file

@ -1,5 +1,10 @@
2005-08-17 Andy Wingo <wingo@pobox.com>
* gst/gstpipeline.c (gst_pipeline_change_state): Interpret
play-timeout==0 to mean no timeout at all. In that case, don't
bother with a get_state or a warning, just return directly, even
if it's ASYNC.
* gst/base/gstbasetransform.c: Debug changes.
* gst/gstutils.h:

View file

@ -255,6 +255,7 @@ gst_pipeline_change_state (GstElement * element)
GstElementStateReturn result = GST_STATE_SUCCESS;
GstPipeline *pipeline = GST_PIPELINE (element);
gint transition = GST_STATE_TRANSITION (element);
GstClockTime play_timeout;
GstClock *clock;
switch (transition) {
@ -339,23 +340,27 @@ gst_pipeline_change_state (GstElement * element)
break;
}
/* we wait for async state changes ourselves when we are in an
* intermediate state.
* FIXME this can block forever, better do this in a worker
* thread or use a timeout? */
if (result == GST_STATE_ASYNC) {
GST_LOCK (pipeline);
play_timeout = pipeline->play_timeout;
GST_UNLOCK (pipeline);
} else {
play_timeout = 0;
}
/* we wait for async state changes ourselves when we are in an
* intermediate state. */
if (play_timeout > 0) {
GTimeVal *timeval, timeout;
GST_STATE_UNLOCK (pipeline);
GST_LOCK (pipeline);
if (pipeline->play_timeout > 0) {
GST_TIME_TO_TIMEVAL (pipeline->play_timeout, timeout);
timeval = &timeout;
} else {
if (play_timeout == G_MAXUINT64) {
timeval = NULL;
} else {
GST_TIME_TO_TIMEVAL (play_timeout, timeout);
timeval = &timeout;
}
GST_UNLOCK (pipeline);
result = gst_element_get_state (element, NULL, NULL, timeval);
if (result == GST_STATE_ASYNC) {
@ -363,6 +368,7 @@ gst_pipeline_change_state (GstElement * element)
g_warning ("timeout in PREROLL, forcing next state change");
result = GST_STATE_SUCCESS;
}
GST_STATE_LOCK (pipeline);
}