The timeout handler should have lower priority than the source so we don't timeout before popping a message with 0 ti...

Original commit message from CVS:
* gst/gstbus.c: (poll_func), (poll_timeout), (gst_bus_poll):
* tools/gst-launch.c: (main):
The timeout handler should have lower priority than the source
so we don't timeout before popping a message with 0 timeout.
Dump error messages after failed state change.
This commit is contained in:
Wim Taymans 2005-09-20 17:30:35 +00:00
parent d30a4eb913
commit 4fd77c1920
3 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2005-09-20 Wim Taymans <wim@fluendo.com>
* gst/gstbus.c: (poll_func), (poll_timeout), (gst_bus_poll):
* tools/gst-launch.c: (main):
The timeout handler should have lower priority than the source
so we don't timeout before popping a message with 0 timeout.
Dump error messages after failed state change.
2005-09-20 Tim-Philipp Müller <tim at centricular dot net>
* tools/gst-inspect.c: (print_element_properties_info):

View file

@ -657,13 +657,16 @@ typedef struct
static gboolean
poll_func (GstBus * bus, GstMessage * message, GstBusPollData * poll_data)
{
if (!g_main_loop_is_running (poll_data->loop))
if (!g_main_loop_is_running (poll_data->loop)) {
GST_DEBUG ("mainloop %p not running", poll_data->loop);
return TRUE;
}
if (GST_MESSAGE_TYPE (message) & poll_data->events) {
g_return_val_if_fail (poll_data->message == NULL, FALSE);
/* keep ref to message */
poll_data->message = gst_message_ref (message);
GST_DEBUG ("mainloop %p quit", poll_data->loop);
g_main_loop_quit (poll_data->loop);
} else {
/* don't remove the source. */
@ -676,6 +679,7 @@ poll_func (GstBus * bus, GstMessage * message, GstBusPollData * poll_data)
static gboolean
poll_timeout (GstBusPollData * poll_data)
{
GST_DEBUG ("mainloop %p quit", poll_data->loop);
g_main_loop_quit (poll_data->loop);
/* we don't remove the GSource as this would free our poll_data,
@ -739,10 +743,12 @@ gst_bus_poll (GstBus * bus, GstMessageType events, GstClockTimeDiff timeout)
else
poll_data->timeout_id = 0;
id = gst_bus_add_watch_full (bus, G_PRIORITY_DEFAULT_IDLE, GST_MESSAGE_ANY,
id = gst_bus_add_watch_full (bus, G_PRIORITY_DEFAULT, GST_MESSAGE_ANY,
(GstBusFunc) poll_func, poll_data, (GDestroyNotify) poll_destroy);
GST_DEBUG ("running mainloop %p", poll_data->loop);
g_main_loop_run (poll_data->loop);
GST_DEBUG ("mainloop stopped %p", poll_data->loop);
/* holds a ref */
ret = poll_data->message;

View file

@ -609,6 +609,7 @@ main (int argc, char *argv[])
case GST_STATE_CHANGE_FAILURE:
fprintf (stderr, _("ERROR: pipeline doesn't want to pause.\n"));
res = -1;
event_loop (pipeline, FALSE);
goto end;
case GST_STATE_CHANGE_NO_PREROLL:
fprintf (stderr, _("NO_PREROLL pipeline ...\n"));