hybris/pulseaudio-modules-droid: fix compatibility with pulseaudio>=13.0 (!667)

There were some API changes:
 - 878ef44079
 - 6665b466d2

Leading to error at run time:
 Error relocating /usr/lib/pulse-13.0/modules/libdroid-sink.so: pa_make_realtime: symbol not found
 Error relocating /usr/lib/pulse-13.0/modules/libdroid-source.so: pa_make_realtime: symbol not found
 Error relocating /usr/lib/pulse-13.0/modules/libdroid-source.so: pa_source_get_state: symbol not found

Fixes are:
 - include <pulse/util.h>, replace pa_make_realtime -> pa_thread_make_realtime
 - replace pa_source_get_state(X) -> X->state
 - replace pa_sink_get_state(X) -> X->state

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Alexey Min 2019-10-06 23:21:59 +03:00 committed by Oliver Smith
parent a855164812
commit e9e60806cb
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 151 additions and 2 deletions

View file

@ -0,0 +1,147 @@
From 78273e5c65600392ad077bd05d6e8703553acae3 Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Sun, 6 Oct 2019 23:14:46 +0300
Subject: [PATCH] Fix compatibility with pulseaudio>=13.0
There were some API changes:
- https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/878ef440797f0fe319dcb1e866c29cec39b8a36d
- https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/6665b466d28ca6f166c22846777f541f5bc9cef7
Leading to:
Error relocating /usr/lib/pulse-13.0/modules/libdroid-sink.so: pa_make_realtime: symbol not found
Error relocating /usr/lib/pulse-13.0/modules/libdroid-source.so: pa_make_realtime: symbol not found
Error relocating /usr/lib/pulse-13.0/modules/libdroid-source.so: pa_source_get_state: symbol not found
Fixes are:
- include <pulse/util.h>, replace pa_make_realtime -> pa_thread_make_realtime
- replace pa_source_get_state(X) -> X->state
- replace pa_sink_get_state(X) -> X->state
---
src/droid/droid-sink.c | 5 +++++
src/droid/droid-source.c | 9 +++++++++
src/droid/module-droid-keepalive.c | 17 +++++++++++++++++
3 files changed, 31 insertions(+)
diff --git a/src/droid/droid-sink.c b/src/droid/droid-sink.c
index a857f6c..1cb290e 100644
--- a/src/droid/droid-sink.c
+++ b/src/droid/droid-sink.c
@@ -54,6 +54,7 @@
#include <pulsecore/time-smoother.h>
#include <pulsecore/hashmap.h>
#include <pulsecore/core-subscribe.h>
+#include <pulse/version.h>
#include "droid-sink.h"
#include <droid/droid-util.h>
@@ -371,7 +372,11 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up.");
if (u->core->realtime_scheduling)
+#if (PA_CHECK_VERSION(13,0,0))
+ pa_thread_make_realtime(u->core->realtime_priority);
+#else
pa_make_realtime(u->core->realtime_priority);
+#endif
pa_thread_mq_install(&u->thread_mq);
diff --git a/src/droid/droid-source.c b/src/droid/droid-source.c
index 999060f..55ff99f 100644
--- a/src/droid/droid-source.c
+++ b/src/droid/droid-source.c
@@ -51,6 +51,7 @@
#include <pulsecore/rtpoll.h>
#include <pulsecore/time-smoother.h>
#include <pulsecore/resampler.h>
+#include <pulse/version.h>
#include "droid-source.h"
#include <droid/droid-util.h>
@@ -208,7 +209,11 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up.");
if (u->core->realtime_scheduling)
+#if (PA_CHECK_VERSION(13,0,0))
+ pa_thread_make_realtime(u->core->realtime_priority);
+#else
pa_make_realtime(u->core->realtime_priority);
+#endif
pa_thread_mq_install(&u->thread_mq);
@@ -366,7 +371,11 @@ static int source_set_port_cb(pa_source *s, pa_device_port *p) {
pa_log_debug("Source set port %u", data->device);
+#if (PA_CHECK_VERSION(13,0,0))
+ if (!PA_SOURCE_IS_OPENED(u->source->state))
+#else
if (!PA_SOURCE_IS_OPENED(pa_source_get_state(u->source)))
+#endif
do_routing(u, data->device);
else {
pa_asyncmsgq_post(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_DO_ROUTING, PA_UINT_TO_PTR(data->device), 0, NULL, NULL);
diff --git a/src/droid/module-droid-keepalive.c b/src/droid/module-droid-keepalive.c
index 5f0b70a..40b2b9e 100644
--- a/src/droid/module-droid-keepalive.c
+++ b/src/droid/module-droid-keepalive.c
@@ -31,6 +31,7 @@
#endif
#include <pulse/xmalloc.h>
+#include <pulse/version.h>
#include <pulsecore/core.h>
#include <pulsecore/i18n.h>
@@ -86,7 +87,11 @@ static void stop(struct userdata *u) {
return;
while ((sink = pa_idxset_iterate(u->core->sinks, &state, NULL))) {
+#if (PA_CHECK_VERSION(13,0,0))
+ if (sink->state != PA_SINK_SUSPENDED)
+#else
if (pa_sink_get_state(sink) != PA_SINK_SUSPENDED)
+#endif
return;
}
@@ -94,7 +99,11 @@ static void stop(struct userdata *u) {
while ((source = pa_idxset_iterate(u->core->sources, &state, NULL))) {
if (source->monitor_of)
continue;
+#if (PA_CHECK_VERSION(13,0,0))
+ if (source->state != PA_SOURCE_SUSPENDED)
+#else
if (pa_source_get_state(source) != PA_SOURCE_SUSPENDED)
+#endif
return;
}
@@ -107,7 +116,11 @@ static void update_sink(pa_sink *sink, struct userdata *u) {
pa_assert(sink);
pa_assert(u);
+#if (PA_CHECK_VERSION(13,0,0))
+ if (sink->state != PA_SINK_SUSPENDED)
+#else
if (pa_sink_get_state(sink) != PA_SINK_SUSPENDED)
+#endif
start(u);
else
stop(u);
@@ -119,7 +132,11 @@ static void update_source(pa_source *source, struct userdata *u) {
/* Don't react on monitor state changes. */
if (!source->monitor_of) {
+#if (PA_CHECK_VERSION(13,0,0))
+ if (source->state != PA_SOURCE_SUSPENDED)
+#else
if (pa_source_get_state(source) != PA_SOURCE_SUSPENDED)
+#endif
start(u);
else
stop(u);
--
2.21.0

View file

@ -6,7 +6,7 @@ pkgver=13.0
# _pkgver used in URL to download tarball
# Yes, we can build slightly older modules version against newer pulseaudio, if we are lucky
_pkgver=12.2.79
pkgrel=0
pkgrel=1
pkgdesc="PulseAudio Droid modules by Mer project"
url="https://github.com/mer-hybris/pulseaudio-modules-droid"
arch="x86 armv7 aarch64"
@ -17,6 +17,7 @@ options="!check" # No test suite available
source="
$pkgname-$_pkgver.tar.gz::https://github.com/mer-hybris/$pkgname/archive/$_pkgver.tar.gz
0001-configure-ac-compat.patch
0002-Fix-compatibility-with-pulseaudio-13.0.patch
"
install="$pkgname.post-install"
subpackages=""
@ -97,4 +98,5 @@ _variant() {
}
sha512sums="9190dfd5891e0ed580e3135eebb322a00ec99cd3af708047e75c23bd5bf6681151ac1facda08f933679464afff15d421168e549b0ae84756b0e3c97d52693865 pulseaudio-modules-droid-12.2.79.tar.gz
2aa283c64d8623c035522b89b62c80130d14c145a73e6193e2e98c26525cc12670e50f8db4649029e731b61d08c1e5ab2bd4e1a3dae8ca077bbdabe3a69eaa17 0001-configure-ac-compat.patch"
2aa283c64d8623c035522b89b62c80130d14c145a73e6193e2e98c26525cc12670e50f8db4649029e731b61d08c1e5ab2bd4e1a3dae8ca077bbdabe3a69eaa17 0001-configure-ac-compat.patch
e5cf7c3c11fa096bcd2fbe95c9e4135c0b9c1383b2c8c2c0cf43a554122849cc01d9e2b99cab9ec0ef51375ca013e653c6bdfd5c86145a18b3a70cef8bdf7b3e 0002-Fix-compatibility-with-pulseaudio-13.0.patch"