ext/hal/: Check if the device UDI is set before trying to query HAL about it and give a useful error message if it wa...

Original commit message from CVS:
* ext/hal/gsthalaudiosink.c: (do_toggle_element):
* ext/hal/gsthalaudiosrc.c: (do_toggle_element):
Check if the device UDI is set before trying to query HAL
about it and give a useful error message if it wasn't set.
* ext/hal/hal.c: (gst_hal_get_string):
Don't query HAL for NULL UDIs. Passing NULL as UDI to HAL
gives an assertion failure in D-Bus when running with
DBUS_FATAL_WARNINGS=1.
This commit is contained in:
Sebastian Dröge 2007-03-01 01:48:59 +00:00
parent 9597bb3f07
commit 16490dc0cf
5 changed files with 28 additions and 3 deletions

View file

@ -1,3 +1,14 @@
2007-03-01 Sebastian Dröge <slomo@circular-chaos.org>
* ext/hal/gsthalaudiosink.c: (do_toggle_element):
* ext/hal/gsthalaudiosrc.c: (do_toggle_element):
Check if the device UDI is set before trying to query HAL
about it and give a useful error message if it wasn't set.
* ext/hal/hal.c: (gst_hal_get_string):
Don't query HAL for NULL UDIs. Passing NULL as UDI to HAL
gives an assertion failure in D-Bus when running with
DBUS_FATAL_WARNINGS=1.
2007-02-28 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac:

2
common

@ -1 +1 @@
Subproject commit 54c2a701c28dcddaf051abf09a360223acd096c9
Subproject commit 9a56e28fc15440eb6852411321c46312e1d1bb73

View file

@ -162,7 +162,11 @@ do_toggle_element (GstHalAudioSink * sink)
}
GST_DEBUG_OBJECT (sink, "Creating new kid");
if (!(sink->kid = gst_hal_get_audio_sink (sink->udi))) {
if (!sink->udi) {
GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL),
("No UDI set for device"));
return FALSE;
} else if (!(sink->kid = gst_hal_get_audio_sink (sink->udi))) {
GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL),
("Failed to render audio sink from Hal"));
return FALSE;

View file

@ -164,7 +164,11 @@ do_toggle_element (GstHalAudioSrc * src)
}
GST_DEBUG_OBJECT (src, "Creating new kid");
if (!(src->kid = gst_hal_get_audio_src (src->udi))) {
if (!src->udi) {
GST_ELEMENT_ERROR (src, LIBRARY, SETTINGS, (NULL),
("No UDI set for device"));
return FALSE;
} else if (!(src->kid = gst_hal_get_audio_src (src->udi))) {
GST_ELEMENT_ERROR (src, LIBRARY, SETTINGS, (NULL),
("Failed to render audio source from Hal"));
return FALSE;

View file

@ -50,6 +50,12 @@ gst_hal_get_string (const gchar * udi)
LibHalContext *ctx;
char *string;
/* Don't query HAL for NULL UDIs. Passing NULL as UDI to HAL gives
* an assertion failure in D-Bus when running with
* DBUS_FATAL_WARNINGS=1. */
if (!udi)
return NULL;
dbus_error_init (&error);
connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);