[Spice-devel] [client] spice-gtk: Recover from GStreamer audio initialization errors
Francois Gouget
fgouget at codeweavers.com
Tue Dec 8 10:24:44 PST 2015
gst_init() will terminate the program in case of a failure so it's
better to use gst_init_check() so we can recover from errors.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
src/spice-gstaudio.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
index 1623421..096fea4 100644
--- a/src/spice-gstaudio.c
+++ b/src/spice-gstaudio.c
@@ -551,15 +551,17 @@ static gboolean connect_channel(SpiceAudio *audio, SpiceChannel *channel)
SpiceGstaudio *spice_gstaudio_new(SpiceSession *session, GMainContext *context,
const char *name)
{
- SpiceGstaudio *gstaudio;
-
- gst_init(NULL, NULL);
- gstaudio = g_object_new(SPICE_TYPE_GSTAUDIO,
+ GError *err = NULL;
+ if (gst_init_check(NULL, NULL, &err)) {
+ return g_object_new(SPICE_TYPE_GSTAUDIO,
"session", session,
"main-context", context,
NULL);
+ }
- return gstaudio;
+ g_warning("Disabling GStreamer audio support: %s", err->message);
+ g_clear_error(&err);
+ return NULL;
}
static void spice_gstaudio_get_playback_volume_info_async(SpiceAudio *audio,
--
2.6.2
More information about the Spice-devel
mailing list