mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
minor service IO fixes
This commit is contained in:
parent
d9e3abaf83
commit
b18c8755d6
1 changed files with 4 additions and 7 deletions
|
|
@ -162,20 +162,18 @@ static int init_bt(struct userdata *u);
|
||||||
static int init_profile(struct userdata *u);
|
static int init_profile(struct userdata *u);
|
||||||
|
|
||||||
static int service_send(struct userdata *u, const bt_audio_msg_header_t *msg) {
|
static int service_send(struct userdata *u, const bt_audio_msg_header_t *msg) {
|
||||||
size_t length;
|
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
pa_assert(u->service_fd >= 0);
|
pa_assert(u->service_fd >= 0);
|
||||||
pa_assert(msg);
|
pa_assert(msg);
|
||||||
|
pa_assert(msg->length > 0);
|
||||||
length = msg->length ? msg->length : BT_SUGGESTED_BUFFER_SIZE;
|
|
||||||
|
|
||||||
pa_log_debug("Sending %s -> %s",
|
pa_log_debug("Sending %s -> %s",
|
||||||
pa_strnull(bt_audio_strtype(msg->type)),
|
pa_strnull(bt_audio_strtype(msg->type)),
|
||||||
pa_strnull(bt_audio_strname(msg->name)));
|
pa_strnull(bt_audio_strname(msg->name)));
|
||||||
|
|
||||||
if ((r = pa_loop_write(u->service_fd, msg, length, &u->service_write_type)) == (ssize_t) length)
|
if ((r = pa_loop_write(u->service_fd, msg, msg->length, &u->service_write_type)) == (ssize_t) msg->length)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|
@ -207,7 +205,7 @@ static int service_recv(struct userdata *u, bt_audio_msg_header_t *msg, size_t r
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Second, read the payload */
|
/* Secondly, read the payload */
|
||||||
if (msg->length > sizeof(*msg)) {
|
if (msg->length > sizeof(*msg)) {
|
||||||
|
|
||||||
size_t remains = msg->length - sizeof(*msg);
|
size_t remains = msg->length - sizeof(*msg);
|
||||||
|
|
@ -217,7 +215,6 @@ static int service_recv(struct userdata *u, bt_audio_msg_header_t *msg, size_t r
|
||||||
remains,
|
remains,
|
||||||
&u->service_read_type)) != (ssize_t) remains)
|
&u->service_read_type)) != (ssize_t) remains)
|
||||||
goto read_fail;
|
goto read_fail;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_log_debug("Received %s <- %s",
|
pa_log_debug("Received %s <- %s",
|
||||||
|
|
@ -231,7 +228,7 @@ read_fail:
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
pa_log_error("Error receiving data from audio service: %s", pa_cstrerror(errno));
|
pa_log_error("Error receiving data from audio service: %s", pa_cstrerror(errno));
|
||||||
else
|
else
|
||||||
pa_log_error("Short recv()");
|
pa_log_error("Short read()");
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue