[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] 2 commits: bluetooth: Implement reading SO_TIMESTAMP for A2DP source
Tanu Kaskinen
gitlab at gitlab.freedesktop.org
Thu Jan 2 11:38:08 UTC 2020
Tanu Kaskinen pushed to branch master at PulseAudio / pulseaudio
Commits:
3f13af50 by Pali Rohár at 2020-01-02T13:32:40+02:00
bluetooth: Implement reading SO_TIMESTAMP for A2DP source
- - - - -
de666447 by Pali Rohár at 2020-01-02T13:32:45+02:00
bluetooth: Print SO_TIMESTAMP warning for SCO source only once
- - - - -
1 changed file:
- src/modules/bluetooth/module-bluez5-device.c
Changes:
=====================================
src/modules/bluetooth/module-bluez5-device.c
=====================================
@@ -395,7 +395,9 @@ static int sco_process_push(struct userdata *u) {
}
if (!found_tstamp) {
- pa_log_warn("Couldn't find SO_TIMESTAMP data in auxiliary recvmsg() data!");
+ PA_ONCE_BEGIN {
+ pa_log_warn("Couldn't find SO_TIMESTAMP data in auxiliary recvmsg() data!");
+ } PA_ONCE_END;
tstamp = pa_rtclock_now();
}
@@ -548,13 +550,29 @@ static int a2dp_process_push(struct userdata *u) {
a2dp_prepare_decoder_buffer(u);
for (;;) {
+ uint8_t aux[1024];
+ struct iovec iov;
+ struct cmsghdr *cm;
+ struct msghdr m;
bool found_tstamp = false;
pa_usec_t tstamp;
uint8_t *ptr;
ssize_t l;
size_t processed;
- l = pa_read(u->stream_fd, u->decoder_buffer, u->decoder_buffer_size, &u->stream_write_type);
+ pa_zero(m);
+ pa_zero(aux);
+ pa_zero(iov);
+
+ m.msg_iov = &iov;
+ m.msg_iovlen = 1;
+ m.msg_control = aux;
+ m.msg_controllen = sizeof(aux);
+
+ iov.iov_base = u->decoder_buffer;
+ iov.iov_len = u->decoder_buffer_size;
+
+ l = recvmsg(u->stream_fd, &m, 0);
if (l <= 0) {
@@ -574,8 +592,21 @@ static int a2dp_process_push(struct userdata *u) {
pa_assert((size_t) l <= u->decoder_buffer_size);
/* TODO: get timestamp from rtp */
+
+ for (cm = CMSG_FIRSTHDR(&m); cm; cm = CMSG_NXTHDR(&m, cm)) {
+ if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SO_TIMESTAMP) {
+ struct timeval *tv = (struct timeval*) CMSG_DATA(cm);
+ pa_rtclock_from_wallclock(tv);
+ tstamp = pa_timeval_load(tv);
+ found_tstamp = true;
+ break;
+ }
+ }
+
if (!found_tstamp) {
- /* pa_log_warn("Couldn't find SO_TIMESTAMP data in auxiliary recvmsg() data!"); */
+ PA_ONCE_BEGIN {
+ pa_log_warn("Couldn't find SO_TIMESTAMP data in auxiliary recvmsg() data!");
+ } PA_ONCE_END;
tstamp = pa_rtclock_now();
}
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/compare/cdcb01889c785f16ca8893ee4735ea31f710bdb7...de66644776da40ac7e8d706fb5d5a36d007fa7ee
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/compare/cdcb01889c785f16ca8893ee4735ea31f710bdb7...de66644776da40ac7e8d706fb5d5a36d007fa7ee
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20200102/d87d0611/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list