[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.19-485-gd11cd33
Lennart Poettering
gitmailer-noreply at 0pointer.de
Mon Feb 22 18:23:09 PST 2010
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The master branch has been updated
from c97013109494f9bc977db38d6ae4e972e59574f4 (commit)
- Log -----------------------------------------------------------------
d11cd33 alsa: don't make use of tsched related variables when tsched is disabled
-----------------------------------------------------------------------
Summary of changes:
src/modules/alsa/alsa-sink.c | 34 +++++++++++++++++++++++-----------
src/modules/alsa/alsa-source.c | 28 +++++++++++++++++-----------
2 files changed, 40 insertions(+), 22 deletions(-)
-----------------------------------------------------------------------
commit d11cd33e3aff14fdd66826b3252d90b1b0e38c48
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Feb 23 03:23:22 2010 +0100
alsa: don't make use of tsched related variables when tsched is disabled
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 60c10c4..581b943 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -629,11 +629,14 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
}
}
- *sleep_usec = pa_bytes_to_usec(left_to_play, &u->sink->sample_spec);
+ if (u->use_tsched) {
+ *sleep_usec = pa_bytes_to_usec(left_to_play, &u->sink->sample_spec);
- if (*sleep_usec > process_usec)
- *sleep_usec -= process_usec;
- else
+ if (*sleep_usec > process_usec)
+ *sleep_usec -= process_usec;
+ else
+ *sleep_usec = 0;
+ } else
*sleep_usec = 0;
return work_done ? 1 : 0;
@@ -766,11 +769,14 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
}
}
- *sleep_usec = pa_bytes_to_usec(left_to_play, &u->sink->sample_spec);
+ if (u->use_tsched) {
+ *sleep_usec = pa_bytes_to_usec(left_to_play, &u->sink->sample_spec);
- if (*sleep_usec > process_usec)
- *sleep_usec -= process_usec;
- else
+ if (*sleep_usec > process_usec)
+ *sleep_usec -= process_usec;
+ else
+ *sleep_usec = 0;
+ } else
*sleep_usec = 0;
return work_done ? 1 : 0;
@@ -1267,6 +1273,9 @@ static void sink_update_requested_latency_cb(pa_sink *s) {
struct userdata *u = s->userdata;
size_t before;
pa_assert(u);
+ pa_assert(u->use_tsched); /* only when timer scheduling is used
+ * we can dynamically adjust the
+ * latency */
if (!u->pcm_handle)
return;
@@ -1301,7 +1310,10 @@ static int process_rewind(struct userdata *u) {
return -1;
}
- unused_nbytes = u->tsched_watermark + (size_t) unused * u->frame_size;
+ unused_nbytes = (size_t) unused * u->frame_size;
+
+ if (u->use_tsched)
+ unused_nbytes += u->tsched_watermark;
if (u->hwbuf_size > unused_nbytes)
limit_nbytes = u->hwbuf_size - unused_nbytes;
@@ -1862,7 +1874,8 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
}
u->sink->parent.process_msg = sink_process_msg;
- u->sink->update_requested_latency = sink_update_requested_latency_cb;
+ if (u->use_tsched)
+ u->sink->update_requested_latency = sink_update_requested_latency_cb;
u->sink->set_state = sink_set_state_cb;
u->sink->set_port = sink_set_port_cb;
u->sink->userdata = u;
@@ -1906,7 +1919,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
} else
pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->hwbuf_size, &ss));
-
reserve_update(u);
if (update_sw_params(u) < 0)
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index f8b583e..1022d0d 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -603,12 +603,14 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
}
}
- *sleep_usec = pa_bytes_to_usec(left_to_record, &u->source->sample_spec);
+ if (u->use_tsched) {
+ *sleep_usec = pa_bytes_to_usec(left_to_record, &u->source->sample_spec);
- if (*sleep_usec > process_usec)
- *sleep_usec -= process_usec;
- else
- *sleep_usec = 0;
+ if (*sleep_usec > process_usec)
+ *sleep_usec -= process_usec;
+ else
+ *sleep_usec = 0;
+ }
return work_done ? 1 : 0;
}
@@ -730,12 +732,14 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
}
}
- *sleep_usec = pa_bytes_to_usec(left_to_record, &u->source->sample_spec);
+ if (u->use_tsched) {
+ *sleep_usec = pa_bytes_to_usec(left_to_record, &u->source->sample_spec);
- if (*sleep_usec > process_usec)
- *sleep_usec -= process_usec;
- else
- *sleep_usec = 0;
+ if (*sleep_usec > process_usec)
+ *sleep_usec -= process_usec;
+ else
+ *sleep_usec = 0;
+ }
return work_done ? 1 : 0;
}
@@ -1205,6 +1209,7 @@ static int source_set_port_cb(pa_source *s, pa_device_port *p) {
static void source_update_requested_latency_cb(pa_source *s) {
struct userdata *u = s->userdata;
pa_assert(u);
+ pa_assert(u->use_tsched);
if (!u->pcm_handle)
return;
@@ -1693,7 +1698,8 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
}
u->source->parent.process_msg = source_process_msg;
- u->source->update_requested_latency = source_update_requested_latency_cb;
+ if (u->use_tsched)
+ u->source->update_requested_latency = source_update_requested_latency_cb;
u->source->set_state = source_set_state_cb;
u->source->set_port = source_set_port_cb;
u->source->userdata = u;
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list