[pulseaudio-commits] 8 commits - src/modules src/pulse src/pulsecore src/tests
Arun Raghavan
arun at kemper.freedesktop.org
Mon Mar 25 02:49:20 PDT 2013
src/modules/alsa/alsa-sink.c | 5 +
src/modules/rtp/module-rtp-send.c | 97 +++++++++++++++++++++++++++-----------
src/pulse/stream.c | 26 +++++++---
src/pulsecore/memblockq.c | 8 +--
src/pulsecore/protocol-native.c | 16 +++---
src/tests/alsa-time-test.c | 24 ++++++++-
6 files changed, 127 insertions(+), 49 deletions(-)
New commits:
commit 15009b03f1f50c588183bf275d04e7b4bdaf4ea3
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date: Mon Nov 26 12:12:05 2012 +0530
protocol-native: Fix some debug output
s->buffer_attr_req is what we want to be printing from since that holds
the actualy requested buffer attributes.
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 00c56a6..7095519 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -907,16 +907,16 @@ static void fix_playback_buffer_attr(playback_stream *s) {
#ifdef PROTOCOL_NATIVE_DEBUG
pa_log("Client requested: maxlength=%li bytes tlength=%li bytes minreq=%li bytes prebuf=%li bytes",
- (long) s->buffer_attr.maxlength,
- (long) s->buffer_attr.tlength,
- (long) s->buffer_attr.minreq,
- (long) s->buffer_attr.prebuf);
+ (long) s->buffer_attr_req.maxlength,
+ (long) s->buffer_attr_req.tlength,
+ (long) s->buffer_attr_req.minreq,
+ (long) s->buffer_attr_req.prebuf);
pa_log("Client requested: maxlength=%lu ms tlength=%lu ms minreq=%lu ms prebuf=%lu ms",
- (unsigned long) (pa_bytes_to_usec(s->buffer_attr.maxlength, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC),
- (unsigned long) (pa_bytes_to_usec(s->buffer_attr.tlength, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC),
- (unsigned long) (pa_bytes_to_usec(s->buffer_attr.minreq, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC),
- (unsigned long) (pa_bytes_to_usec(s->buffer_attr.prebuf, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC));
+ (unsigned long) (pa_bytes_to_usec(s->buffer_attr_req.maxlength, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC),
+ (unsigned long) (pa_bytes_to_usec(s->buffer_attr_req.tlength, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC),
+ (unsigned long) (pa_bytes_to_usec(s->buffer_attr_req.minreq, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC),
+ (unsigned long) (pa_bytes_to_usec(s->buffer_attr_req.prebuf, &s->sink_input->sample_spec) / PA_USEC_PER_MSEC));
#endif
/* This function will be called from the main thread, before as
commit 33715281782e206ff02237a56002b1225a5631f8
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date: Thu Nov 22 10:00:07 2012 +0530
alsa: Minor debug log addition
It's helpful to know what kind of scheduling latency we're expecting in
that debug log.
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 3ac3a36..97fddbf 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1824,8 +1824,9 @@ static void thread_func(void *userdata) {
(double) ((int64_t) real_sleep - (int64_t) rtpoll_sleep) / PA_USEC_PER_MSEC);
#endif
if (u->use_tsched && real_sleep > rtpoll_sleep + u->tsched_watermark)
- pa_log_info("Scheduling delay of %0.2fms, you might want to investigate this to improve latency...",
- (double) (real_sleep - rtpoll_sleep) / PA_USEC_PER_MSEC);
+ pa_log_info("Scheduling delay of %0.2fms > %0.2fms, you might want to investigate this to improve latency...",
+ (double) (real_sleep - rtpoll_sleep) / PA_USEC_PER_MSEC,
+ (double) (u->tsched_watermark) / PA_USEC_PER_MSEC);
}
if (u->sink->flags & PA_SINK_DEFERRED_VOLUME)
commit 45f8ece06e163c18d287537bd34ad4cf21b69229
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date: Thu Nov 22 09:58:08 2012 +0530
stream: Make it easier to enable debug output
This is only useful while hacking on PulseAudio.
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index f692d37..ca5ea0d 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -44,6 +44,8 @@
#include "internal.h"
#include "stream.h"
+/* #define STREAM_DEBUG */
+
#define AUTO_TIMING_INTERVAL_START_USEC (10*PA_USEC_PER_MSEC)
#define AUTO_TIMING_INTERVAL_END_USEC (1500*PA_USEC_PER_MSEC)
@@ -385,7 +387,9 @@ static void request_auto_timing_update(pa_stream *s, pa_bool_t force) {
(force || !s->auto_timing_update_requested)) {
pa_operation *o;
-/* pa_log("Automatically requesting new timing data"); */
+#ifdef STREAM_DEBUG
+ pa_log_debug("Automatically requesting new timing data");
+#endif
if ((o = pa_stream_update_timing_info(s, NULL, NULL))) {
pa_operation_unref(o);
@@ -836,7 +840,9 @@ void pa_command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tag
s->requested_bytes += bytes;
- /* pa_log("got request for %lli, now at %lli", (long long) bytes, (long long) s->requested_bytes); */
+#ifdef STREAM_DEBUG
+ pa_log_debug("got request for %lli, now at %lli", (long long) bytes, (long long) s->requested_bytes);
+#endif
if (s->requested_bytes > 0 && s->write_callback)
s->write_callback(s, (size_t) s->requested_bytes, s->write_userdata);
@@ -912,7 +918,9 @@ static void invalidate_indexes(pa_stream *s, pa_bool_t r, pa_bool_t w) {
pa_assert(s);
pa_assert(PA_REFCNT_VALUE(s) >= 1);
-/* pa_log("invalidate r:%u w:%u tag:%u", r, w, s->context->ctag); */
+#ifdef STREAM_DEBUG
+ pa_log_debug("invalidate r:%u w:%u tag:%u", r, w, s->context->ctag);
+#endif
if (s->state != PA_STREAM_READY)
return;
@@ -923,7 +931,9 @@ static void invalidate_indexes(pa_stream *s, pa_bool_t r, pa_bool_t w) {
if (s->timing_info_valid)
s->timing_info.write_index_corrupt = TRUE;
-/* pa_log("write_index invalidated"); */
+#ifdef STREAM_DEBUG
+ pa_log_debug("write_index invalidated");
+#endif
}
if (r) {
@@ -932,7 +942,9 @@ static void invalidate_indexes(pa_stream *s, pa_bool_t r, pa_bool_t w) {
if (s->timing_info_valid)
s->timing_info.read_index_corrupt = TRUE;
-/* pa_log("read_index invalidated"); */
+#ifdef STREAM_DEBUG
+ pa_log_debug("read_index invalidated");
+#endif
}
request_auto_timing_update(s, TRUE);
@@ -1542,7 +1554,9 @@ int pa_stream_write(
* that's OK, the server side applies the same error */
s->requested_bytes -= (seek == PA_SEEK_RELATIVE ? offset : 0) + (int64_t) length;
- /* pa_log("wrote %lli, now at %lli", (long long) length, (long long) s->requested_bytes); */
+#ifdef STREAM_DEBUG
+ pa_log_debug("wrote %lli, now at %lli", (long long) length, (long long) s->requested_bytes);
+#endif
if (s->direction == PA_STREAM_PLAYBACK) {
commit 994f8fac1fe6c088a6414cf2def8f1d7ee6a0791
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date: Thu Nov 22 08:31:59 2012 +0530
core: Fix up some debug logging
Replaces some debugging-only pa_log() calls with pa_log_debug() so we
only get spammed while debugging if we want to be.
diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c
index 0c245d2..5b9a44b 100644
--- a/src/pulsecore/memblockq.c
+++ b/src/pulsecore/memblockq.c
@@ -259,7 +259,7 @@ static void write_index_changed(pa_memblockq *bq, int64_t old_write_index, pa_bo
bq->missing -= delta;
#ifdef MEMBLOCKQ_DEBUG
- pa_log("[%s] pushed/seeked %lli: requested counter at %lli, account=%i", bq->name, (long long) delta, (long long) bq->requested, account);
+ pa_log_debug("[%s] pushed/seeked %lli: requested counter at %lli, account=%i", bq->name, (long long) delta, (long long) bq->requested, account);
#endif
}
@@ -272,7 +272,7 @@ static void read_index_changed(pa_memblockq *bq, int64_t old_read_index) {
bq->missing += delta;
#ifdef MEMBLOCKQ_DEBUG
- pa_log("[%s] popped %lli: missing counter at %lli", bq->name, (long long) delta, (long long) bq->missing);
+ pa_log_debug("[%s] popped %lli: missing counter at %lli", bq->name, (long long) delta, (long long) bq->missing);
#endif
}
@@ -832,7 +832,7 @@ size_t pa_memblockq_pop_missing(pa_memblockq *bq) {
pa_assert(bq);
#ifdef MEMBLOCKQ_DEBUG
- pa_log("[%s] pop: %lli", bq->name, (long long) bq->missing);
+ pa_log_debug("[%s] pop: %lli", bq->name, (long long) bq->missing);
#endif
if (bq->missing <= 0)
@@ -844,7 +844,7 @@ size_t pa_memblockq_pop_missing(pa_memblockq *bq) {
bq->missing = 0;
#ifdef MEMBLOCKQ_DEBUG
- pa_log("[%s] sent %lli: request counter is at %lli", bq->name, (long long) l, (long long) bq->requested);
+ pa_log_debug("[%s] sent %lli: request counter is at %lli", bq->name, (long long) l, (long long) bq->requested);
#endif
return l;
commit 088ed8a8d6ffb55ab904f447b743c061167ceb3f
Author: Robin H. Johnson <robbat2 at gentoo.org>
Date: Sat Nov 17 23:31:18 2012 +0000
rtp: Introduce source IP configuration
On a multi-homed system, the user may wish RTP to be used only on
specific interfaces. The default binding of 0.0.0.0 for the source
address causes SAP multicast on all interfaces, which is not ideal.
Introduce a new module argument, that allows selection of the source IP,
and thus interface.
(changes in v2: s/srcip/source_ip)
Signed-off-by: Robin H. Johnson <robbat2 at gentoo.org>
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 00cc6c9..acabcf5 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -64,6 +64,7 @@ PA_MODULE_USAGE(
"channels=<number of channels> "
"rate=<sample rate> "
"destination_ip=<destination IP address> "
+ "source_ip=<source IP address> "
"port=<port number> "
"mtu=<maximum transfer unit> "
"loop=<loopback to local host?> "
@@ -73,6 +74,7 @@ PA_MODULE_USAGE(
#define DEFAULT_PORT 46000
#define DEFAULT_TTL 1
#define SAP_PORT 9875
+#define DEFAULT_SOURCE_IP "0.0.0.0"
#define DEFAULT_DESTINATION_IP "224.0.0.56"
#define MEMBLOCKQ_MAXLENGTH (1024*170)
#define DEFAULT_MTU 1280
@@ -85,6 +87,7 @@ static const char* const valid_modargs[] = {
"rate",
"destination", /* Compatbility */
"destination_ip",
+ "source_ip",
"port",
"mtu" ,
"loop",
@@ -165,6 +168,7 @@ int pa__init(pa_module*m) {
struct userdata *u;
pa_modargs *ma = NULL;
const char *dst_addr;
+ const char *src_addr;
uint32_t port = DEFAULT_PORT, mtu;
uint32_t ttl = DEFAULT_TTL;
sa_family_t af;
@@ -172,9 +176,9 @@ int pa__init(pa_module*m) {
pa_source *s;
pa_sample_spec ss;
pa_channel_map cm;
- struct sockaddr_in dst_sa4, dst_sap_sa4;
+ struct sockaddr_in dst_sa4, dst_sap_sa4, src_sa4, src_sap_sa4;
#ifdef HAVE_IPV6
- struct sockaddr_in6 dst_sa6, dst_sap_sa6;
+ struct sockaddr_in6 dst_sa6, dst_sap_sa6, src_sa6, src_sap_sa6;
#endif
struct sockaddr_storage sa_dst;
pa_source_output *o = NULL;
@@ -242,6 +246,23 @@ int pa__init(pa_module*m) {
goto fail;
}
+ src_addr = pa_modargs_get_value(ma, "source_ip", DEFAULT_SOURCE_IP);
+
+ if (inet_pton(AF_INET, src_addr, &src_sa4.sin_addr) > 0) {
+ src_sa4.sin_family = af = AF_INET;
+ src_sa4.sin_port = htons(0);
+ src_sap_sa4 = src_sa4;
+#ifdef HAVE_IPV6
+ } else if (inet_pton(AF_INET6, src_addr, &src_sa6.sin6_addr) > 0) {
+ src_sa6.sin6_family = af = AF_INET6;
+ src_sa6.sin6_port = htons(0);
+ src_sap_sa6 = src_sa6;
+#endif
+ } else {
+ pa_log("Invalid source address '%s'", src_addr);
+ goto fail;
+ }
+
dst_addr = pa_modargs_get_value(ma, "destination", NULL);
if (dst_addr == NULL)
dst_addr = pa_modargs_get_value(ma, "destination_ip", DEFAULT_DESTINATION_IP);
@@ -268,6 +289,16 @@ int pa__init(pa_module*m) {
goto fail;
}
+ if (af == AF_INET && bind(fd, (struct sockaddr*) &src_sa4, sizeof(src_sa4)) < 0) {
+ pa_log("bind() failed: %s", pa_cstrerror(errno));
+ goto fail;
+#ifdef HAVE_IPV6
+ } else if (af == AF_INET6 && bind(fd, (struct sockaddr*) &src_sa6, sizeof(src_sa6)) < 0) {
+ pa_log("bind() failed: %s", pa_cstrerror(errno));
+ goto fail;
+#endif
+ }
+
if (af == AF_INET && connect(fd, (struct sockaddr*) &dst_sa4, sizeof(dst_sa4)) < 0) {
pa_log("connect() failed: %s", pa_cstrerror(errno));
goto fail;
@@ -283,6 +314,16 @@ int pa__init(pa_module*m) {
goto fail;
}
+ if (af == AF_INET && bind(sap_fd, (struct sockaddr*) &src_sap_sa4, sizeof(src_sap_sa4)) < 0) {
+ pa_log("bind() failed: %s", pa_cstrerror(errno));
+ goto fail;
+#ifdef HAVE_IPV6
+ } else if (af == AF_INET6 && bind(sap_fd, (struct sockaddr*) &src_sap_sa6, sizeof(src_sap_sa6)) < 0) {
+ pa_log("bind() failed: %s", pa_cstrerror(errno));
+ goto fail;
+#endif
+ }
+
if (af == AF_INET && connect(sap_fd, (struct sockaddr*) &dst_sap_sa4, sizeof(dst_sap_sa4)) < 0) {
pa_log("connect() failed: %s", pa_cstrerror(errno));
goto fail;
@@ -320,6 +361,7 @@ int pa__init(pa_module*m) {
pa_source_output_new_data_init(&data);
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_NAME, "RTP Monitor Stream");
+ pa_proplist_sets(data.proplist, "rtp.source", src_addr);
pa_proplist_sets(data.proplist, "rtp.destination", dst_addr);
pa_proplist_setf(data.proplist, "rtp.mtu", "%lu", (unsigned long) mtu);
pa_proplist_setf(data.proplist, "rtp.port", "%lu", (unsigned long) port);
@@ -387,7 +429,7 @@ int pa__init(pa_module*m) {
pa_rtp_context_init_send(&u->rtp_context, fd, m->core->cookie, payload, pa_frame_size(&ss));
pa_sap_context_init_send(&u->sap_context, sap_fd, p);
- pa_log_info("RTP stream initialized with mtu %u on %s:%u ttl=%u, SSRC=0x%08x, payload=%u, initial sequence #%u", mtu, dst_addr, port, ttl, u->rtp_context.ssrc, payload, u->rtp_context.sequence);
+ pa_log_info("RTP stream initialized with mtu %u on %s:%u from %s ttl=%u, SSRC=0x%08x, payload=%u, initial sequence #%u", mtu, dst_addr, port, src_addr, ttl, u->rtp_context.ssrc, payload, u->rtp_context.sequence);
pa_log_info("SDP-Data:\n%s\nEOF", p);
pa_sap_send(&u->sap_context, 0);
commit d18c3664b53b543a34da82e2229129cacf8a11ff
Author: Robin H. Johnson <robbat2 at gentoo.org>
Date: Sat Nov 17 23:31:17 2012 +0000
rtp: rename modarg destination to destination_ip
The module argument 'source' already has special meaning as the
pa_source, however, the argument 'destination' expects an IP address.
Prior to introducing a source IP modarg for the source IP address,
rename the 'destination' argument to 'destination_ip'. Include
compatibility support for old RTP users so they don't need to change
their module usage immediately.
(changes in v2: minor formatting fixes, s/dstip/destination_ip)
Signed-off-by: Robin H. Johnson <robbat2 at gentoo.org>
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 95cb439..00cc6c9 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -63,7 +63,7 @@ PA_MODULE_USAGE(
"format=<sample format> "
"channels=<number of channels> "
"rate=<sample rate> "
- "destination=<destination IP address> "
+ "destination_ip=<destination IP address> "
"port=<port number> "
"mtu=<maximum transfer unit> "
"loop=<loopback to local host?> "
@@ -73,7 +73,7 @@ PA_MODULE_USAGE(
#define DEFAULT_PORT 46000
#define DEFAULT_TTL 1
#define SAP_PORT 9875
-#define DEFAULT_DESTINATION "224.0.0.56"
+#define DEFAULT_DESTINATION_IP "224.0.0.56"
#define MEMBLOCKQ_MAXLENGTH (1024*170)
#define DEFAULT_MTU 1280
#define SAP_INTERVAL (5*PA_USEC_PER_SEC)
@@ -83,7 +83,8 @@ static const char* const valid_modargs[] = {
"format",
"channels",
"rate",
- "destination",
+ "destination", /* Compatbility */
+ "destination_ip",
"port",
"mtu" ,
"loop",
@@ -241,7 +242,9 @@ int pa__init(pa_module*m) {
goto fail;
}
- dst_addr = pa_modargs_get_value(ma, "destination", DEFAULT_DESTINATION);
+ dst_addr = pa_modargs_get_value(ma, "destination", NULL);
+ if (dst_addr == NULL)
+ dst_addr = pa_modargs_get_value(ma, "destination_ip", DEFAULT_DESTINATION_IP);
if (inet_pton(AF_INET, dst_addr, &dst_sa4.sin_addr) > 0) {
dst_sa4.sin_family = af = AF_INET;
commit ce0294ccf2ca00b28b41c253283b726218a9bb44
Author: Robin H. Johnson <robbat2 at gentoo.org>
Date: Sat Nov 17 23:31:16 2012 +0000
rtp: Cleanup variable naming.
Before introducing new functionality, clarify the variable names
dest -> dst_addr
sa[46] -> dst_sa[46]
sap_sa[46] -> dst_sap_sa[46]
Signed-off-by: Robin H. Johnson <robbat2 at gentoo.org>
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 6502664..95cb439 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -163,7 +163,7 @@ static void sap_event_cb(pa_mainloop_api *m, pa_time_event *t, const struct time
int pa__init(pa_module*m) {
struct userdata *u;
pa_modargs *ma = NULL;
- const char *dest;
+ const char *dst_addr;
uint32_t port = DEFAULT_PORT, mtu;
uint32_t ttl = DEFAULT_TTL;
sa_family_t af;
@@ -171,9 +171,9 @@ int pa__init(pa_module*m) {
pa_source *s;
pa_sample_spec ss;
pa_channel_map cm;
- struct sockaddr_in sa4, sap_sa4;
+ struct sockaddr_in dst_sa4, dst_sap_sa4;
#ifdef HAVE_IPV6
- struct sockaddr_in6 sa6, sap_sa6;
+ struct sockaddr_in6 dst_sa6, dst_sap_sa6;
#endif
struct sockaddr_storage sa_dst;
pa_source_output *o = NULL;
@@ -241,22 +241,22 @@ int pa__init(pa_module*m) {
goto fail;
}
- dest = pa_modargs_get_value(ma, "destination", DEFAULT_DESTINATION);
+ dst_addr = pa_modargs_get_value(ma, "destination", DEFAULT_DESTINATION);
- if (inet_pton(AF_INET, dest, &sa4.sin_addr) > 0) {
- sa4.sin_family = af = AF_INET;
- sa4.sin_port = htons((uint16_t) port);
- sap_sa4 = sa4;
- sap_sa4.sin_port = htons(SAP_PORT);
+ if (inet_pton(AF_INET, dst_addr, &dst_sa4.sin_addr) > 0) {
+ dst_sa4.sin_family = af = AF_INET;
+ dst_sa4.sin_port = htons((uint16_t) port);
+ dst_sap_sa4 = dst_sa4;
+ dst_sap_sa4.sin_port = htons(SAP_PORT);
#ifdef HAVE_IPV6
- } else if (inet_pton(AF_INET6, dest, &sa6.sin6_addr) > 0) {
- sa6.sin6_family = af = AF_INET6;
- sa6.sin6_port = htons((uint16_t) port);
- sap_sa6 = sa6;
- sap_sa6.sin6_port = htons(SAP_PORT);
+ } else if (inet_pton(AF_INET6, dst_addr, &dst_sa6.sin6_addr) > 0) {
+ dst_sa6.sin6_family = af = AF_INET6;
+ dst_sa6.sin6_port = htons((uint16_t) port);
+ dst_sap_sa6 = dst_sa6;
+ dst_sap_sa6.sin6_port = htons(SAP_PORT);
#endif
} else {
- pa_log("Invalid destination '%s'", dest);
+ pa_log("Invalid destination '%s'", dst_addr);
goto fail;
}
@@ -265,11 +265,11 @@ int pa__init(pa_module*m) {
goto fail;
}
- if (af == AF_INET && connect(fd, (struct sockaddr*) &sa4, sizeof(sa4)) < 0) {
+ if (af == AF_INET && connect(fd, (struct sockaddr*) &dst_sa4, sizeof(dst_sa4)) < 0) {
pa_log("connect() failed: %s", pa_cstrerror(errno));
goto fail;
#ifdef HAVE_IPV6
- } else if (af == AF_INET6 && connect(fd, (struct sockaddr*) &sa6, sizeof(sa6)) < 0) {
+ } else if (af == AF_INET6 && connect(fd, (struct sockaddr*) &dst_sa6, sizeof(dst_sa6)) < 0) {
pa_log("connect() failed: %s", pa_cstrerror(errno));
goto fail;
#endif
@@ -280,11 +280,11 @@ int pa__init(pa_module*m) {
goto fail;
}
- if (af == AF_INET && connect(sap_fd, (struct sockaddr*) &sap_sa4, sizeof(sap_sa4)) < 0) {
+ if (af == AF_INET && connect(sap_fd, (struct sockaddr*) &dst_sap_sa4, sizeof(dst_sap_sa4)) < 0) {
pa_log("connect() failed: %s", pa_cstrerror(errno));
goto fail;
#ifdef HAVE_IPV6
- } else if (af == AF_INET6 && connect(sap_fd, (struct sockaddr*) &sap_sa6, sizeof(sap_sa6)) < 0) {
+ } else if (af == AF_INET6 && connect(sap_fd, (struct sockaddr*) &dst_sap_sa6, sizeof(dst_sap_sa6)) < 0) {
pa_log("connect() failed: %s", pa_cstrerror(errno));
goto fail;
#endif
@@ -317,7 +317,7 @@ int pa__init(pa_module*m) {
pa_source_output_new_data_init(&data);
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_NAME, "RTP Monitor Stream");
- pa_proplist_sets(data.proplist, "rtp.destination", dest);
+ pa_proplist_sets(data.proplist, "rtp.destination", dst_addr);
pa_proplist_setf(data.proplist, "rtp.mtu", "%lu", (unsigned long) mtu);
pa_proplist_setf(data.proplist, "rtp.port", "%lu", (unsigned long) port);
pa_proplist_setf(data.proplist, "rtp.ttl", "%lu", (unsigned long) ttl);
@@ -368,13 +368,13 @@ int pa__init(pa_module*m) {
if (af == AF_INET) {
p = pa_sdp_build(af,
(void*) &((struct sockaddr_in*) &sa_dst)->sin_addr,
- (void*) &sa4.sin_addr,
+ (void*) &dst_sa4.sin_addr,
n, (uint16_t) port, payload, &ss);
#ifdef HAVE_IPV6
} else {
p = pa_sdp_build(af,
(void*) &((struct sockaddr_in6*) &sa_dst)->sin6_addr,
- (void*) &sa6.sin6_addr,
+ (void*) &dst_sa6.sin6_addr,
n, (uint16_t) port, payload, &ss);
#endif
}
@@ -384,7 +384,7 @@ int pa__init(pa_module*m) {
pa_rtp_context_init_send(&u->rtp_context, fd, m->core->cookie, payload, pa_frame_size(&ss));
pa_sap_context_init_send(&u->sap_context, sap_fd, p);
- pa_log_info("RTP stream initialized with mtu %u on %s:%u ttl=%u, SSRC=0x%08x, payload=%u, initial sequence #%u", mtu, dest, port, ttl, u->rtp_context.ssrc, payload, u->rtp_context.sequence);
+ pa_log_info("RTP stream initialized with mtu %u on %s:%u ttl=%u, SSRC=0x%08x, payload=%u, initial sequence #%u", mtu, dst_addr, port, ttl, u->rtp_context.ssrc, payload, u->rtp_context.sequence);
pa_log_info("SDP-Data:\n%s\nEOF", p);
pa_sap_send(&u->sap_context, 0);
commit 93a4a82bd3ebf26cbd37b3a8d686ecd5e8c63934
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date: Thu Nov 8 14:54:51 2012 +0530
tests: Minor alsa-time-test improvments
Tries to get RT privs and prints elapsed time and a periodic header to
make grokking the output easier.
diff --git a/src/tests/alsa-time-test.c b/src/tests/alsa-time-test.c
index ab194ee..3c82fdc 100644
--- a/src/tests/alsa-time-test.c
+++ b/src/tests/alsa-time-test.c
@@ -5,6 +5,8 @@
#include <assert.h>
#include <inttypes.h>
#include <time.h>
+#include <unistd.h>
+#include <pthread.h>
#include <alsa/asoundlib.h>
@@ -16,7 +18,7 @@ static uint64_t timespec_us(const struct timespec *ts) {
int main(int argc, char *argv[]) {
const char *dev;
- int r, cap;
+ int r, cap, count = 0;
snd_pcm_hw_params_t *hwparams;
snd_pcm_sw_params_t *swparams;
snd_pcm_status_t *status;
@@ -26,11 +28,20 @@ int main(int argc, char *argv[]) {
snd_pcm_uframes_t boundary, buffer_size = 44100/10; /* 100s */
int dir = 1;
struct timespec start, last_timestamp = { 0, 0 };
- uint64_t start_us;
+ uint64_t start_us, last_us = 0;
snd_pcm_sframes_t last_avail = 0, last_delay = 0;
struct pollfd *pollfds;
int n_pollfd;
int64_t sample_count = 0;
+ struct sched_param sp;
+
+ r = -1;
+#ifdef _POSIX_PRIORITY_SCHEDULING
+ sp.sched_priority = 5;
+ r = pthread_setschedparam(pthread_self(), SCHED_RR, &sp);
+#endif
+ if (r)
+ printf("Could not get RT prio. :(\n");
snd_pcm_hw_params_alloca(&hwparams);
snd_pcm_sw_params_alloca(&swparams);
@@ -128,6 +139,8 @@ int main(int argc, char *argv[]) {
r = snd_pcm_poll_descriptors(pcm, pollfds, n_pollfd);
assert(r == n_pollfd);
+ printf("Starting. Buffer size is %u frames\n", (unsigned int) buffer_size);
+
if (cap) {
r = snd_pcm_start(pcm);
assert(r == 0);
@@ -203,7 +216,11 @@ int main(int argc, char *argv[]) {
else
pos = (unsigned long long) ((sample_count - handled + delay) * 1000000LU / 44100);
- printf("%llu\t%llu\t%llu\t%llu\t%li\t%li\t%i\t%i\t%i\n",
+ if (count++ % 50 == 0)
+ printf("Elapsed\tCPU\tALSA\tPos\tSamples\tavail\tdelay\trevents\thandled\tstate\n");
+
+ printf("%llu\t%llu\t%llu\t%llu\t%llu\t%li\t%li\t%i\t%i\t%i\n",
+ (unsigned long long) (now_us - last_us),
(unsigned long long) (now_us - start_us),
(unsigned long long) (timestamp_us ? timestamp_us - start_us : 0),
pos,
@@ -222,6 +239,7 @@ int main(int argc, char *argv[]) {
last_avail = avail;
last_delay = delay;
last_timestamp = timestamp;
+ last_us = now_us;
}
return 0;
More information about the pulseaudio-commits
mailing list