summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Gouget <fgouget@codeweavers.com>2015-12-08 19:24:44 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2015-12-09 11:49:02 +0100
commite8fde7c546eda396181c8809f9b91fb1091cd195 (patch)
tree2e55dcc3c8d356723a084bdea6282953a2bb87f6
parent983984f2760c5df84556fc72d69d76f778effa7d (diff)
downloadspice-gtk-e8fde7c546eda396181c8809f9b91fb1091cd195.tar.gz
spice-gtk-e8fde7c546eda396181c8809f9b91fb1091cd195.tar.xz
spice-gtk-e8fde7c546eda396181c8809f9b91fb1091cd195.zip
spice-gtk: Recover from GStreamer audio initialization errors
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@codeweavers.com>
-rw-r--r--src/spice-gstaudio.c12
1 files 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,