Re: [client] spice-gtk: Recover from GStreamer audio initialization errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ack

----- Original Message -----
> 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@xxxxxxxxxxxxxxx>
> ---
>  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
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]