pulsesink: Better error message when server version is too old
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 29 Apr 2013 05:37:56 +0000 (11:07 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 29 Apr 2013 06:24:26 +0000 (11:54 +0530)
We check for the library version at configure time, but the server
version can only really be checked at run-time.

https://bugzilla.gnome.org/show_bug.cgi?id=698768

ext/pulse/pulsesink.c

index 585174d..08dfe55 100644 (file)
@@ -531,6 +531,11 @@ gst_pulseringbuffer_open_device (GstAudioRingBuffer * buf)
     pa_threaded_mainloop_wait (mainloop);
   }
 
     pa_threaded_mainloop_wait (mainloop);
   }
 
+  if (pa_context_get_server_protocol_version (pbuf->context) < 22) {
+    /* We need PulseAudio >= 1.0 on the server side for the extended API */
+    goto bad_server_version;
+  }
+
   GST_LOG_OBJECT (psink, "opened the device");
 
   pa_threaded_mainloop_unlock (mainloop);
   GST_LOG_OBJECT (psink, "opened the device");
 
   pa_threaded_mainloop_unlock (mainloop);
@@ -559,6 +564,12 @@ connect_failed:
             pa_strerror (pa_context_errno (pctx->context))), (NULL));
     goto unlock_and_fail;
   }
             pa_strerror (pa_context_errno (pctx->context))), (NULL));
     goto unlock_and_fail;
   }
+bad_server_version:
+  {
+    GST_ELEMENT_ERROR (psink, RESOURCE, FAILED, ("PulseAudio server version "
+            "is too old."), (NULL));
+    goto unlock_and_fail;
+  }
 }
 
 /* close the device */
 }
 
 /* close the device */