summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/modules/bluetooth/bluetooth-util.c8
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c15
-rw-r--r--src/modules/bluetooth/module-bluetooth-proximity.c4
3 files changed, 16 insertions, 11 deletions
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index dfd3a306..9e30f89a 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -604,7 +604,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
pa_bluetooth_device_free(d);
}
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.bluez.Adapter", "DeviceCreated")) {
const char *path;
@@ -617,7 +617,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
pa_log_debug("Device %s created", path);
found_device(y, path);
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.bluez.Manager", "AdapterAdded")) {
const char *path;
@@ -630,7 +630,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
pa_log_debug("Adapter %s created", path);
found_adapter(y, path);
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.bluez.Headset", "PropertyChanged") ||
dbus_message_is_signal(m, "org.bluez.AudioSink", "PropertyChanged") ||
@@ -663,7 +663,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
run_callback(y, d, TRUE);
}
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
fail:
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 495bc82f..2d9ede50 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -700,6 +700,9 @@ static int start_stream_fd(struct userdata *u) {
pollfd->fd = u->stream_fd;
pollfd->events = pollfd->revents = 0;
+ u->read_index = 0;
+ u->write_index = 0;
+
return 0;
}
@@ -873,7 +876,7 @@ static int hsp_process_render(struct userdata *u) {
pa_assert(l != 0);
if (l < 0) {
- if (errno == EINTR)
+ if (errno == EINTR || errno == EAGAIN)
continue;
else {
pa_log_error("Failed to write data to SCO socket: %s", pa_cstrerror(errno));
@@ -918,7 +921,7 @@ static int hsp_process_push(struct userdata *u) {
pa_memblock_release(memchunk.memblock);
if (l <= 0) {
- if (l < 0 && errno == EINTR)
+ if (l < 0 && (errno == EINTR || errno == EAGAIN))
continue;
else {
pa_log_error("Failed to read data from SCO socket: %s", l < 0 ? pa_cstrerror(errno) : "EOF");
@@ -1041,7 +1044,7 @@ static int a2dp_process_render(struct userdata *u) {
pa_assert(l != 0);
if (l < 0) {
- if (errno == EINTR)
+ if (errno == EINTR || errno == EAGAIN)
continue;
else {
pa_log_error("Failed to write data to socket: %s", pa_cstrerror(errno));
@@ -1123,6 +1126,8 @@ static void thread_func(void *userdata) {
}
if (writable && do_write) {
+ if (u->write_index == 0)
+ u->started_at = pa_rtclock_usec();
if (u->profile == PROFILE_A2DP) {
if (a2dp_process_render(u) < 0)
@@ -1159,8 +1164,8 @@ static void thread_func(void *userdata) {
/* Hmm, nothing to do. Let's sleep */
if (pollfd)
- pollfd->events = (short) (((u->sink && PA_SINK_IS_OPENED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
- (u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state) ? POLLIN : 0));
+ pollfd->events = (short) (((u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
+ (u->source && PA_SOURCE_IS_LINKED(u->source->thread_info.state) ? POLLIN : 0));
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0)
goto fail;
diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c
index a3b525ee..c8d7b4d9 100644
--- a/src/modules/bluetooth/module-bluetooth-proximity.c
+++ b/src/modules/bluetooth/module-bluetooth-proximity.c
@@ -302,7 +302,7 @@ static DBusHandlerResult filter_func(DBusConnection *connection, DBusMessage *m,
bonding_new(u, a);
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.bluez.Adapter", "BondingRemoved")) {
@@ -315,7 +315,7 @@ static DBusHandlerResult filter_func(DBusConnection *connection, DBusMessage *m,
bonding_remove(u, a);
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
finish: