From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 08/10] Update a2dp transport delay when it changes
Date: Mon, 13 Sep 2010 17:15:35 +0300 [thread overview]
Message-ID: <1284387337-18822-9-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1284387337-18822-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
---
audio/a2dp.c | 31 +++++++++++++++++++++++++++----
audio/media.c | 6 ++++++
audio/media.h | 2 ++
audio/transport.c | 14 ++++++++++++++
audio/transport.h | 2 ++
5 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/audio/a2dp.c b/audio/a2dp.c
index e6daf3b..7d3f25f 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -44,6 +44,7 @@
#include "source.h"
#include "unix.h"
#include "media.h"
+#include "transport.h"
#include "a2dp.h"
#include "sdpd.h"
@@ -600,9 +601,9 @@ static gboolean endpoint_setconf_ind(struct avdtp *session,
}
static gboolean endpoint_getcap_ind(struct avdtp *session,
- struct avdtp_local_sep *sep,
- gboolean get_all,
- GSList **caps, uint8_t *err, void *user_data)
+ struct avdtp_local_sep *sep,
+ gboolean get_all, GSList **caps,
+ uint8_t *err, void *user_data)
{
struct a2dp_sep *a2dp_sep = user_data;
struct avdtp_service_capability *media_transport, *media_codec;
@@ -1031,6 +1032,28 @@ static gboolean delayreport_ind(struct avdtp *session,
return TRUE;
}
+static gboolean endpoint_delayreport_ind(struct avdtp *session,
+ struct avdtp_local_sep *sep,
+ uint8_t rseid, uint16_t delay,
+ uint8_t *err, void *user_data)
+{
+ struct a2dp_sep *a2dp_sep = user_data;
+ struct media_transport *transport;
+
+ if (a2dp_sep->type == AVDTP_SEP_TYPE_SINK)
+ DBG("Sink %p: DelayReport_Ind", sep);
+ else
+ DBG("Source %p: DelayReport_Ind", sep);
+
+ transport = media_endpoint_get_transport(a2dp_sep->endpoint);
+ if (transport == NULL)
+ return FALSE;
+
+ media_transport_update_delay(transport, delay);
+
+ return TRUE;
+}
+
static void reconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
struct avdtp_stream *stream, struct avdtp_error *err,
void *user_data)
@@ -1115,7 +1138,7 @@ static struct avdtp_sep_ind endpoint_ind = {
.close = close_ind,
.abort = abort_ind,
.reconfigure = reconf_ind,
- .delayreport = delayreport_ind,
+ .delayreport = endpoint_delayreport_ind,
};
static sdp_record_t *a2dp_record(uint8_t type, uint16_t avdtp_ver)
diff --git a/audio/media.c b/audio/media.c
index da9d3ae..19ba1c4 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -681,3 +681,9 @@ uint8_t media_endpoint_get_codec(struct media_endpoint *endpoint)
{
return endpoint->codec;
}
+
+struct media_transport *media_endpoint_get_transport(
+ struct media_endpoint *endpoint)
+{
+ return endpoint->transport;
+}
diff --git a/audio/media.h b/audio/media.h
index f6d144c..d089103 100644
--- a/audio/media.h
+++ b/audio/media.h
@@ -50,3 +50,5 @@ void media_endpoint_release(struct media_endpoint *endpoint);
struct a2dp_sep *media_endpoint_get_sep(struct media_endpoint *endpoint);
const char *media_endpoint_get_uuid(struct media_endpoint *endpoint);
uint8_t media_endpoint_get_codec(struct media_endpoint *endpoint);
+struct media_transport *media_endpoint_get_transport(
+ struct media_endpoint *endpoint);
diff --git a/audio/transport.c b/audio/transport.c
index c4d78a4..0da99e8 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -669,3 +669,17 @@ const char *media_transport_get_path(struct media_transport *transport)
{
return transport->path;
}
+
+void media_transport_update_delay(struct media_transport *transport,
+ uint16_t delay)
+{
+ /* Check if delay really changed */
+ if (transport->delay == delay)
+ return;
+
+ transport->delay = delay;
+
+ emit_property_changed(transport->conn, transport->path,
+ MEDIA_TRANSPORT_INTERFACE, "Delay",
+ DBUS_TYPE_UINT16, &transport->delay);
+}
diff --git a/audio/transport.h b/audio/transport.h
index a7594f0..f2eb37b 100644
--- a/audio/transport.h
+++ b/audio/transport.h
@@ -32,3 +32,5 @@ struct media_transport *media_transport_create(DBusConnection *conn,
void media_transport_remove(struct media_transport *transport);
const char *media_transport_get_path(struct media_transport *transport);
+void media_transport_update_delay(struct media_transport *transport,
+ uint16_t delay);
--
1.7.1
next prev parent reply other threads:[~2010-09-13 14:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-13 14:15 [PATCH 00/10] Media API Luiz Augusto von Dentz
2010-09-13 14:15 ` [PATCH 01/10] Add media API documentation Luiz Augusto von Dentz
2010-09-13 14:15 ` [PATCH 02/10] Add rule to enabling talking to org.bluez.MediaEndpoint Luiz Augusto von Dentz
2010-09-13 14:15 ` [PATCH 03/10] Add option to enable/disable unix ipc via audio.conf Luiz Augusto von Dentz
2010-09-13 14:15 ` [PATCH 04/10] Add support for media transport in gstreamer plugin Luiz Augusto von Dentz
2010-09-13 14:15 ` [PATCH 05/10] Add simple-endpoint test script Luiz Augusto von Dentz
2010-09-13 14:15 ` [PATCH 06/10] Add initial implementation of org.bluez.Media spec Luiz Augusto von Dentz
2010-09-13 14:15 ` [PATCH 07/10] Introduce headset_get_inband Luiz Augusto von Dentz
2010-09-13 14:15 ` Luiz Augusto von Dentz [this message]
2010-09-13 14:15 ` [PATCH 09/10] Remove local cache for nrec and inband Luiz Augusto von Dentz
2010-09-13 14:15 ` [PATCH 10/10] Add proper checks for MediaTransport.SetProperty Luiz Augusto von Dentz
2010-09-15 13:35 ` [PATCH 00/10] Media API Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1284387337-18822-9-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).