summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-04-10 02:26:59 +0200
committerLennart Poettering <lennart@poettering.net>2009-04-10 02:26:59 +0200
commit991cb0613488a81be2eb7d8ed1a8f1b891eb9f13 (patch)
tree48dc237c24dbd93a2e11e66b7dbd00b632ce5722
parent80e18c8da35eb988d10ccada436ab11710c298f6 (diff)
set fixed latencies at more places where appropriate
-rw-r--r--src/modules/alsa/alsa-sink.c10
-rw-r--r--src/modules/alsa/alsa-source.c7
-rw-r--r--src/modules/module-pipe-sink.c1
-rw-r--r--src/modules/module-pipe-source.c1
-rw-r--r--src/modules/module-sine-source.c4
-rw-r--r--src/modules/oss/module-oss.c2
6 files changed, 16 insertions, 9 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index c18c34efb..401b003f4 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1703,14 +1703,13 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
(double) pa_bytes_to_usec(u->hwbuf_size, &ss) / PA_USEC_PER_MSEC);
pa_sink_set_max_request(u->sink, u->hwbuf_size);
+ pa_sink_set_max_rewind(u->sink, u->hwbuf_size);
if (u->use_tsched) {
- fix_min_sleep_wakeup(u);
- fix_tsched_watermark(u);
-
u->watermark_step = pa_usec_to_bytes(TSCHED_WATERMARK_STEP_USEC, &u->sink->sample_spec);
- pa_sink_set_max_rewind(u->sink, u->hwbuf_size);
+ fix_min_sleep_wakeup(u);
+ fix_tsched_watermark(u);
pa_sink_set_latency_range(u->sink,
0,
@@ -1718,7 +1717,8 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
pa_log_info("Time scheduling watermark is %0.2fms",
(double) pa_bytes_to_usec(u->tsched_watermark, &ss) / PA_USEC_PER_MSEC);
- }
+ } else
+ u->sink->fixed_latency = pa_bytes_to_usec(u->hwbuf_size, &ss);
reserve_update(u);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 9cbd79fa7..99e825c4e 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1558,18 +1558,19 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
(double) pa_bytes_to_usec(u->hwbuf_size, &ss) / PA_USEC_PER_MSEC);
if (u->use_tsched) {
+ u->watermark_step = pa_usec_to_bytes(TSCHED_WATERMARK_STEP_USEC, &u->source->sample_spec);
+
fix_min_sleep_wakeup(u);
fix_tsched_watermark(u);
- u->watermark_step = pa_usec_to_bytes(TSCHED_WATERMARK_STEP_USEC, &u->source->sample_spec);
-
pa_source_set_latency_range(u->source,
0,
pa_bytes_to_usec(u->hwbuf_size, &ss));
pa_log_info("Time scheduling watermark is %0.2fms",
(double) pa_bytes_to_usec(u->tsched_watermark, &ss) / PA_USEC_PER_MSEC);
- }
+ } else
+ u->source->fixed_latency = pa_bytes_to_usec(u->hwbuf_size, &ss);
reserve_update(u);
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 26b6b96ec..9d3e55d8e 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -293,6 +293,7 @@ int pa__init(pa_module*m) {
pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
pa_sink_set_rtpoll(u->sink, u->rtpoll);
pa_sink_set_max_request(u->sink, PIPE_BUF);
+ u->sink->fixed_latency = pa_bytes_to_usec(PIPE_BUF, &u->sink->sample_spec);
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index 3d40fdf3a..df72d7984 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -277,6 +277,7 @@ int pa__init(pa_module*m) {
pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
pa_source_set_rtpoll(u->source, u->rtpoll);
+ u->source->fixed_latency = pa_bytes_to_usec(PIPE_BUF, &u->source->sample_spec);
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
diff --git a/src/modules/module-sine-source.c b/src/modules/module-sine-source.c
index 50e473075..a5f1ce705 100644
--- a/src/modules/module-sine-source.c
+++ b/src/modules/module-sine-source.c
@@ -260,10 +260,12 @@ int pa__init(pa_module*m) {
u->source->update_requested_latency = source_update_requested_latency_cb;
u->source->userdata = u;
+ u->block_usec = BLOCK_USEC;
+
pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
pa_source_set_rtpoll(u->source, u->rtpoll);
+ u->source->fixed_latency = u->block_usec;
- u->block_usec = BLOCK_USEC;
if (!(u->thread = pa_thread_new(thread_func, u))) {
pa_log("Failed to create thread.");
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index f67f47e1b..855e8a352 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -1326,6 +1326,7 @@ int pa__init(pa_module*m) {
pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
pa_source_set_rtpoll(u->source, u->rtpoll);
u->source->refresh_volume = TRUE;
+ u->source->fixed_latency = pa_bytes_to_usec(u->in_hwbuf_size, &u->source->sample_spec);
if (use_mmap)
u->in_mmap_memblocks = pa_xnew0(pa_memblock*, u->in_nfrags);
@@ -1387,6 +1388,7 @@ int pa__init(pa_module*m) {
pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
pa_sink_set_rtpoll(u->sink, u->rtpoll);
u->sink->refresh_volume = TRUE;
+ u->sink->fixed_latency = pa_bytes_to_usec(u->out_hwbuf_size, &u->sink->sample_spec);
pa_sink_set_max_request(u->sink, u->out_hwbuf_size);