Merge lp:~zequence/pulseaudio/ubuntu.precise-fix into lp:~ubuntu-audio-dev/pulseaudio/ubuntu.precise

Proposed by Kaj Ailomaa
Status: Merged
Merge reported by: David Henningsson
Merged at revision: not available
Proposed branch: lp:~zequence/pulseaudio/ubuntu.precise-fix
Merge into: lp:~ubuntu-audio-dev/pulseaudio/ubuntu.precise
Diff against target: 247 lines (+224/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/0127-reserve-card.patch (+215/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~zequence/pulseaudio/ubuntu.precise-fix
Reviewer Review Type Date Requested Status
Ubuntu Audio Development Team Pending
Review via email: mp+164787@code.launchpad.net

Description of the change

Adds a patch that fixes LP: #1163638

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-12-05 13:40:02 +0000
3+++ debian/changelog 2013-05-20 18:27:29 +0000
4@@ -1,3 +1,11 @@
5+pulseaudio (1:1.1-0ubuntu15.3) UNRELEASED; urgency=low
6+
7+ * 0127-reserve-card.patch:
8+ make pulseaudio let go of reserved cards when acquired by jack
9+ (LP: #1163638)
10+
11+ -- Kaj Ailomaa <zequence@mousike.me> Thu, 16 May 2013 22:09:36 +0200
12+
13 pulseaudio (1:1.1-0ubuntu15.2) precise-proposed; urgency=low
14
15 * 0622-Front-headphone.patch:
16
17=== added file 'debian/patches/0127-reserve-card.patch'
18--- debian/patches/0127-reserve-card.patch 1970-01-01 00:00:00 +0000
19+++ debian/patches/0127-reserve-card.patch 2013-05-20 18:27:29 +0000
20@@ -0,0 +1,215 @@
21+From: Kaj Ailomaa <zequence@mousike.me>
22+Description: Fixes an issue where pulseaudio was not giving up a reserved card
23+Origin/Author: upstream, commits dd7cf7ad5ef17e217505fa41ace0c699fe79dada, 6be6766b58b3fa668a95563ac72ebe9970643cad, cb0f3d287857d5385f4a879f8ab565d71bc8f068 and 58def1fd1de0de7d5732519539503a7ad83f24a2
24+Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1163638
25+Index: pulseaudio-1.1/src/modules/reserve-monitor.c
26+===================================================================
27+--- pulseaudio-1.1.orig/src/modules/reserve-monitor.c 2009-12-07 13:10:37.000000000 +0100
28++++ pulseaudio-1.1/src/modules/reserve-monitor.c 2013-05-15 20:07:20.995250003 +0200
29+@@ -32,6 +32,7 @@
30+ #include <assert.h>
31+
32+ #include "reserve-monitor.h"
33++#include "reserve.h"
34+
35+ struct rm_monitor {
36+ int ref;
37+@@ -59,6 +60,23 @@
38+ "member='NameOwnerChanged'," \
39+ "arg0='%s'"
40+
41++static unsigned get_busy(
42++ DBusConnection *c,
43++ const char *name_owner) {
44++
45++ const char *un;
46++
47++ if (!name_owner || !*name_owner)
48++ return FALSE;
49++
50++ /* If we ourselves own the device, then don't consider this 'busy' */
51++ if ((un = dbus_bus_get_unique_name(c)))
52++ if (strcmp(name_owner, un) == 0)
53++ return FALSE;
54++
55++ return TRUE;
56++}
57++
58+ static DBusHandlerResult filter_handler(
59+ DBusConnection *c,
60+ DBusMessage *s,
61+@@ -85,18 +103,11 @@
62+ goto invalid;
63+
64+ if (strcmp(name, m->service_name) == 0) {
65+- m->busy = !!(new && *new);
66++ unsigned old_busy = m->busy;
67+
68+- /* If we ourselves own the device, then don't consider this 'busy' */
69+- if (m->busy) {
70+- const char *un;
71+-
72+- if ((un = dbus_bus_get_unique_name(c)))
73+- if (strcmp(new, un) == 0)
74+- m->busy = FALSE;
75+- }
76++ m->busy = get_busy(c, new);
77+
78+- if (m->change_cb) {
79++ if (m->busy != old_busy && m->change_cb) {
80+ m->ref++;
81+ m->change_cb(m);
82+ rm_release(m);
83+@@ -113,11 +124,12 @@
84+ int rm_watch(
85+ rm_monitor **_m,
86+ DBusConnection *connection,
87+- const char*device_name,
88++ const char *device_name,
89+ rm_change_cb_t change_cb,
90+ DBusError *error) {
91+
92+ rm_monitor *m = NULL;
93++ char *name_owner;
94+ int r;
95+ DBusError _error;
96+
97+@@ -176,12 +188,11 @@
98+
99+ m->matching = 1;
100+
101+- m->busy = dbus_bus_name_has_owner(m->connection, m->service_name, error);
102+-
103+- if (dbus_error_is_set(error)) {
104+- r = -EIO;
105++ if ((r = rd_dbus_get_name_owner(m->connection, m->service_name, &name_owner, error)) < 0)
106+ goto fail;
107+- }
108++
109++ m->busy = get_busy(m->connection, name_owner);
110++ free(name_owner);
111+
112+ *_m = m;
113+ return 0;
114+Index: pulseaudio-1.1/src/modules/reserve.c
115+===================================================================
116+--- pulseaudio-1.1.orig/src/modules/reserve.c 2009-12-07 13:10:37.000000000 +0100
117++++ pulseaudio-1.1/src/modules/reserve.c 2013-05-15 20:07:23.723250100 +0200
118+@@ -293,6 +293,7 @@
119+
120+ rd_device *d;
121+ DBusError error;
122++ char *name_owner = NULL;
123+
124+ dbus_error_init(&error);
125+
126+@@ -310,6 +311,21 @@
127+ goto invalid;
128+
129+ if (strcmp(name, d->service_name) == 0 && d->owning) {
130++ /* Verify the actual owner of the name to avoid leaked NameLost
131++ * signals from previous reservations. The D-Bus daemon will send
132++ * all messages asynchronously in the correct order, but we could
133++ * potentially process them too late due to the pseudo-blocking
134++ * call mechanism used during both acquisition and release. This
135++ * can happen if we release the device and immediately after
136++ * reacquire it before NameLost is processed. */
137++ if (!d->gave_up) {
138++ const char *un;
139++
140++ if ((un = dbus_bus_get_unique_name(c)) && rd_dbus_get_name_owner(c, d->service_name, &name_owner, &error) == 0)
141++ if (strcmp(name_owner, un) == 0)
142++ goto invalid; /* Name still owned by us */
143++ }
144++
145+ d->owning = 0;
146+
147+ if (!d->gave_up) {
148+@@ -326,6 +342,7 @@
149+ }
150+
151+ invalid:
152++ free(name_owner);
153+ dbus_error_free(&error);
154+
155+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
156+@@ -606,3 +623,59 @@
157+
158+ return d->userdata;
159+ }
160++
161++int rd_dbus_get_name_owner(
162++ DBusConnection *connection,
163++ const char *name,
164++ char **name_owner,
165++ DBusError *error) {
166++
167++ DBusMessage *msg, *reply;
168++ int r;
169++
170++ *name_owner = NULL;
171++
172++ if (!(msg = dbus_message_new_method_call(DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "GetNameOwner"))) {
173++ r = -ENOMEM;
174++ goto fail;
175++ }
176++
177++ if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) {
178++ r = -ENOMEM;
179++ goto fail;
180++ }
181++
182++ reply = dbus_connection_send_with_reply_and_block(connection, msg, DBUS_TIMEOUT_USE_DEFAULT, error);
183++ dbus_message_unref(msg);
184++ msg = NULL;
185++
186++ if (reply) {
187++ if (!dbus_message_get_args(reply, error, DBUS_TYPE_STRING, name_owner, DBUS_TYPE_INVALID)) {
188++ dbus_message_unref(reply);
189++ r = -EIO;
190++ goto fail;
191++ }
192++
193++ *name_owner = strdup(*name_owner);
194++ dbus_message_unref(reply);
195++
196++ if (!*name_owner) {
197++ r = -ENOMEM;
198++ goto fail;
199++ }
200++
201++ } else if (dbus_error_has_name(error, "org.freedesktop.DBus.Error.NameHasNoOwner"))
202++ dbus_error_free(error);
203++ else {
204++ r = -EIO;
205++ goto fail;
206++ }
207++
208++ return 0;
209++
210++fail:
211++ if (msg)
212++ dbus_message_unref(msg);
213++
214++ return r;
215++}
216+Index: pulseaudio-1.1/src/modules/reserve.h
217+===================================================================
218+--- pulseaudio-1.1.orig/src/modules/reserve.h 2011-10-28 14:44:20.000000000 +0200
219++++ pulseaudio-1.1/src/modules/reserve.h 2013-05-15 20:07:20.997250003 +0200
220+@@ -72,6 +72,15 @@
221+ * userdata was set. */
222+ void* rd_get_userdata(rd_device *d);
223+
224++/* Helper function to get the unique connection name owning a given
225++ * name. Returns 0 on success, a negative errno style return value on
226++ * error. */
227++int rd_dbus_get_name_owner(
228++ DBusConnection *connection,
229++ const char *name,
230++ char **name_owner,
231++ DBusError *error);
232++
233+ #ifdef __cplusplus
234+ }
235+ #endif
236
237=== modified file 'debian/patches/series'
238--- debian/patches/series 2012-11-09 11:32:16 +0000
239+++ debian/patches/series 2013-05-20 18:27:29 +0000
240@@ -33,6 +33,7 @@
241 0124-device-manager-Fix-a-memory-leak.patch
242 0125-alsa-sink-source-Really-set-volumes-on-port-change.patch
243 0126-alsa-sink-source-Make-sure-volumes-are-synchronised-.patch
244+0127-reserve-card.patch
245
246 # Jack detection patches (upstreamed)
247 0600-ship-PROTOCOL-file.patch

Subscribers

People subscribed via source and target branches