diff options
author | Francois Gouget <fgouget@codeweavers.com> | 2015-12-08 19:24:44 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2015-12-09 11:49:02 +0100 |
commit | e8fde7c546eda396181c8809f9b91fb1091cd195 (patch) | |
tree | 2e55dcc3c8d356723a084bdea6282953a2bb87f6 | |
parent | 983984f2760c5df84556fc72d69d76f778effa7d (diff) | |
download | spice-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.c | 12 |
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, |