summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-11-05 17:02:16 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-11-05 17:02:16 +0000
commit1f1e900f488c2925b8949911b30f363a1fb4dee0 (patch)
tree2e01b9aa0626ff626628fe6eb1353d53d0482899
parent316166212f59f4bc7bad778ff46e8b6986c52874 (diff)
Fix packet lenght to be the output MTU.
-rw-r--r--audio/avdtp.c24
-rw-r--r--audio/avdtp.h3
-rw-r--r--audio/unix.c8
3 files changed, 21 insertions, 14 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index 00045820..f68561e9 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -308,7 +308,8 @@ struct stream_callback {
struct avdtp_stream {
int sock;
- uint16_t mtu;
+ uint16_t imtu;
+ uint16_t omtu;
struct avdtp *session;
struct avdtp_local_sep *lsep;
uint8_t rseid;
@@ -605,7 +606,7 @@ static gboolean transport_cb(GIOChannel *chan, GIOCondition cond,
}
static void handle_transport_connect(struct avdtp *session, int sock,
- uint16_t mtu)
+ uint16_t imtu, uint16_t omtu)
{
struct avdtp_stream *stream = session->pending_open;
struct avdtp_local_sep *sep = stream->lsep;
@@ -629,7 +630,8 @@ static void handle_transport_connect(struct avdtp *session, int sock,
}
stream->sock = sock;
- stream->mtu = mtu;
+ stream->omtu = omtu;
+ stream->imtu = imtu;
if (!stream->open_acp && sep->cfm && sep->cfm->open)
sep->cfm->open(session, sep, stream, NULL, sep->user_data);
@@ -690,7 +692,7 @@ static void avdtp_sep_set_state(struct avdtp *session,
}
session->streams = g_slist_remove(session->streams, stream);
if (session->pending_open == stream)
- handle_transport_connect(session, -1, 0);
+ handle_transport_connect(session, -1, 0, 0);
if (session->req && session->req->stream == stream)
session->req->stream = NULL;
stream_free(stream);
@@ -1573,7 +1575,7 @@ static gboolean l2cap_connect_cb(GIOChannel *chan, GIOCondition cond,
avrcp_connect(dev);
}
else if (session->pending_open)
- handle_transport_connect(session, sk, l2o.imtu);
+ handle_transport_connect(session, sk, l2o.imtu, l2o.omtu);
else {
err = -EIO;
goto failed;
@@ -2274,7 +2276,8 @@ gboolean avdtp_stream_has_capability(struct avdtp_stream *stream,
}
gboolean avdtp_stream_get_transport(struct avdtp_stream *stream, int *sock,
- uint16_t *mtu, GSList **caps)
+ uint16_t *imtu, uint16_t *omtu,
+ GSList **caps)
{
if (stream->sock < 0)
return FALSE;
@@ -2282,8 +2285,11 @@ gboolean avdtp_stream_get_transport(struct avdtp_stream *stream, int *sock,
if (sock)
*sock = stream->sock;
- if (mtu)
- *mtu = stream->mtu;
+ if (omtu)
+ *omtu = stream->omtu;
+
+ if (imtu)
+ *imtu = stream->imtu;
if (caps)
*caps = stream->caps;
@@ -2797,7 +2803,7 @@ static gboolean avdtp_server_cb(GIOChannel *chan, GIOCondition cond, void *data)
session = avdtp_get_internal(&src, &dst);
if (session->pending_open && session->pending_open->open_acp) {
- handle_transport_connect(session, cli_sk, l2o.imtu);
+ handle_transport_connect(session, cli_sk, l2o.imtu, l2o.omtu);
return TRUE;
}
diff --git a/audio/avdtp.h b/audio/avdtp.h
index 99b95477..88684f28 100644
--- a/audio/avdtp.h
+++ b/audio/avdtp.h
@@ -216,7 +216,8 @@ gboolean avdtp_stream_remove_cb(struct avdtp *session,
unsigned int id);
gboolean avdtp_stream_get_transport(struct avdtp_stream *stream, int *sock,
- uint16_t *mtu, GSList **caps);
+ uint16_t *imtu, uint16_t *omtu,
+ GSList **caps);
gboolean avdtp_stream_has_capability(struct avdtp_stream *stream,
struct avdtp_service_capability *cap);
diff --git a/audio/unix.c b/audio/unix.c
index eb849ddc..71eb570a 100644
--- a/audio/unix.c
+++ b/audio/unix.c
@@ -305,7 +305,7 @@ static void a2dp_setup_complete(struct avdtp *session, struct a2dp_sep *sep,
struct ipc_codec_sbc *sbc = (void *) cfg->data;
struct a2dp_data *a2dp = &client->d.a2dp;
int fd;
- uint16_t mtu;
+ uint16_t imtu, omtu;
GSList *caps;
client->req_id = 0;
@@ -321,13 +321,11 @@ static void a2dp_setup_complete(struct avdtp *session, struct a2dp_sep *sep,
a2dp->sep = sep;
a2dp->stream = stream;
- if (!avdtp_stream_get_transport(stream, &fd, &mtu, &caps)) {
+ if (!avdtp_stream_get_transport(stream, &fd, &imtu, &omtu, &caps)) {
error("Unable to get stream transport");
goto failed;
}
- cfg->pkt_len = mtu;
-
for (codec_cap = NULL; caps; caps = g_slist_next(caps)) {
cap = caps->data;
if (cap->category == AVDTP_MEDIA_CODEC) {
@@ -342,6 +340,8 @@ static void a2dp_setup_complete(struct avdtp *session, struct a2dp_sep *sep,
goto failed;
}
+ /* FIXME: Use imtu when fd_opt is CFG_FD_OPT_READ */
+ cfg->pkt_len = omtu;
cfg->fd_opt = CFG_FD_OPT_WRITE;
sbc_cap = (void *) codec_cap;