Re: [Spice-devel] [PATCH spice-gtk 32/34] gst: check pulseaudio plugin version >= 1.15

2019-01-07 Thread Marc-André Lureau
Hi

On Mon, Jan 7, 2019 at 1:11 PM Snir Sheriber  wrote:
>
> Hi,
>
>
> On 1/7/19 10:01 AM, marcandre.lur...@redhat.com wrote:
> > From: Marc-André Lureau 
> >
> > There is a racy bug in pulsesrc that we can't easily workaround:
> > https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/69
> >
> > It will hopefully be fixed with 1.15.
> >
> > In theory, pulseaudio may not be picked by autoaudiosink, but looking
> > up the actual sink or mimicking GstAutoDetect is unnecessarily complicated.
> >
> > Signed-off-by: Marc-André Lureau 
> > ---
> >   src/spice-gstaudio.c | 19 +++
> >   1 file changed, 19 insertions(+)
> >
> > diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
> > index d0cfbc6..d7bfc97 100644
> > --- a/src/spice-gstaudio.c
> > +++ b/src/spice-gstaudio.c
> > @@ -527,7 +527,26 @@ SpiceGstaudio *spice_gstaudio_new(SpiceSession 
> > *session, GMainContext *context,
> > const char *name)
> >   {
> >   GError *err = NULL;
> > +
> >   if (gst_init_check(NULL, NULL, )) {
> > +GstPlugin *plugin;
> > +
> > +plugin = gst_registry_find_plugin(gst_registry_get(), 
> > "pulseaudio");
> > +if (plugin) {
> > +unsigned maj, min;
> > +if (sscanf(gst_plugin_get_version(plugin), "%u.%u", , 
> > ) != 2) {
> > +g_warn_if_reached();
> > +gst_object_unref(plugin);
> > +return NULL;
> > +}
> > +
> > +gst_object_unref(plugin);
> > +if (maj < 1 || min < 15) {
> > +g_warning("Disabling GStreamer audio: bad pulseaudio 
> > plugin version");
> > +return NULL;
> > +}
> > +}
>
>
> You can avoid using the plugin by changing its rank (as we did with
> vaapisink in channel-display-gst.c)

That's an interesting idea, we could make the alsa backend higher
priority than the pulse one with <1.15.

>
> Snir.
>
>
> > +
> >   return g_object_new(SPICE_TYPE_GSTAUDIO,
> >   "session", session,
> >   "main-context", context,
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk 32/34] gst: check pulseaudio plugin version >= 1.15

2019-01-07 Thread Snir Sheriber

Hi,


On 1/7/19 10:01 AM, marcandre.lur...@redhat.com wrote:

From: Marc-André Lureau 

There is a racy bug in pulsesrc that we can't easily workaround:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/69

It will hopefully be fixed with 1.15.

In theory, pulseaudio may not be picked by autoaudiosink, but looking
up the actual sink or mimicking GstAutoDetect is unnecessarily complicated.

Signed-off-by: Marc-André Lureau 
---
  src/spice-gstaudio.c | 19 +++
  1 file changed, 19 insertions(+)

diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
index d0cfbc6..d7bfc97 100644
--- a/src/spice-gstaudio.c
+++ b/src/spice-gstaudio.c
@@ -527,7 +527,26 @@ SpiceGstaudio *spice_gstaudio_new(SpiceSession *session, 
GMainContext *context,
const char *name)
  {
  GError *err = NULL;
+
  if (gst_init_check(NULL, NULL, )) {
+GstPlugin *plugin;
+
+plugin = gst_registry_find_plugin(gst_registry_get(), "pulseaudio");
+if (plugin) {
+unsigned maj, min;
+if (sscanf(gst_plugin_get_version(plugin), "%u.%u", , ) != 
2) {
+g_warn_if_reached();
+gst_object_unref(plugin);
+return NULL;
+}
+
+gst_object_unref(plugin);
+if (maj < 1 || min < 15) {
+g_warning("Disabling GStreamer audio: bad pulseaudio plugin 
version");
+return NULL;
+}
+}



You can avoid using the plugin by changing its rank (as we did with 
vaapisink in channel-display-gst.c)


Snir.



+
  return g_object_new(SPICE_TYPE_GSTAUDIO,
  "session", session,
  "main-context", context,

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel