mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
init min/max latency properly; fix avail_min updating
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2227 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
f3109be9e1
commit
cc1e2654d3
4 changed files with 11 additions and 9 deletions
|
|
@ -436,7 +436,7 @@ static pa_usec_t hw_sleep_time(struct userdata *u) {
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
||||||
usec = pa_sink_get_requested_latency(u->sink);
|
usec = pa_sink_get_requested_latency_within_thread(u->sink);
|
||||||
|
|
||||||
if (usec <= 0)
|
if (usec <= 0)
|
||||||
usec = pa_bytes_to_usec(u->hwbuf_size, &u->sink->sample_spec);
|
usec = pa_bytes_to_usec(u->hwbuf_size, &u->sink->sample_spec);
|
||||||
|
|
@ -461,7 +461,7 @@ static void update_hwbuf_unused_frames(struct userdata *u) {
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
||||||
if ((usec = pa_sink_get_requested_latency(u->sink)) <= 0) {
|
if ((usec = pa_sink_get_requested_latency_within_thread(u->sink)) <= 0) {
|
||||||
/* Use the full buffer if noone asked us for anything
|
/* Use the full buffer if noone asked us for anything
|
||||||
* specific */
|
* specific */
|
||||||
u->hwbuf_unused_frames = 0;
|
u->hwbuf_unused_frames = 0;
|
||||||
|
|
@ -499,8 +499,6 @@ static int update_sw_params(struct userdata *u) {
|
||||||
} else
|
} else
|
||||||
avail_min = 1;
|
avail_min = 1;
|
||||||
|
|
||||||
avail_min = (snd_pcm_uframes_t) -1;
|
|
||||||
|
|
||||||
pa_log("setting avail_min=%lu", (unsigned long) avail_min);
|
pa_log("setting avail_min=%lu", (unsigned long) avail_min);
|
||||||
|
|
||||||
if ((err = pa_alsa_set_sw_params(u->pcm_handle, avail_min)) < 0) {
|
if ((err = pa_alsa_set_sw_params(u->pcm_handle, avail_min)) < 0) {
|
||||||
|
|
@ -1222,8 +1220,10 @@ int pa__init(pa_module*m) {
|
||||||
|
|
||||||
u->sink->thread_info.max_rewind = use_tsched ? u->hwbuf_size : 0;
|
u->sink->thread_info.max_rewind = use_tsched ? u->hwbuf_size : 0;
|
||||||
|
|
||||||
|
u->sink->max_latency = pa_bytes_to_usec(u->hwbuf_size, &ss);
|
||||||
|
|
||||||
if (!use_tsched)
|
if (!use_tsched)
|
||||||
u->sink->min_latency = pa_bytes_to_usec(u->hwbuf_size, &ss);
|
u->sink->min_latency = u->sink->max_latency;
|
||||||
|
|
||||||
pa_log_info("Using %u fragments of size %lu bytes, buffer time is %0.2fms",
|
pa_log_info("Using %u fragments of size %lu bytes, buffer time is %0.2fms",
|
||||||
nfrags, (long unsigned) u->fragment_size,
|
nfrags, (long unsigned) u->fragment_size,
|
||||||
|
|
|
||||||
|
|
@ -411,7 +411,7 @@ static pa_usec_t hw_sleep_time(struct userdata *u) {
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
||||||
usec = pa_source_get_requested_latency(u->source);
|
usec = pa_source_get_requested_latency_within_thread(u->source);
|
||||||
|
|
||||||
if (usec <= 0)
|
if (usec <= 0)
|
||||||
usec = pa_bytes_to_usec(u->hwbuf_size, &u->source->sample_spec);
|
usec = pa_bytes_to_usec(u->hwbuf_size, &u->source->sample_spec);
|
||||||
|
|
@ -1093,8 +1093,10 @@ int pa__init(pa_module*m) {
|
||||||
u->hw_dB_min = u->hw_dB_max = 0;
|
u->hw_dB_min = u->hw_dB_max = 0;
|
||||||
u->hw_volume_min = u->hw_volume_max = 0;
|
u->hw_volume_min = u->hw_volume_max = 0;
|
||||||
|
|
||||||
|
u->source->max_latency = pa_bytes_to_usec(u->hwbuf_size, &ss);
|
||||||
|
|
||||||
if (!use_tsched)
|
if (!use_tsched)
|
||||||
u->source->min_latency = pa_bytes_to_usec(u->hwbuf_size, &ss);
|
u->source->min_latency = u->source->max_latency;
|
||||||
|
|
||||||
pa_log_info("Using %u fragments of size %lu bytes, buffer time is %0.2fms",
|
pa_log_info("Using %u fragments of size %lu bytes, buffer time is %0.2fms",
|
||||||
nfrags, (long unsigned) u->fragment_size,
|
nfrags, (long unsigned) u->fragment_size,
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ static void sink_update_requested_latency(pa_sink *s) {
|
||||||
pa_assert_se(u = s->userdata);
|
pa_assert_se(u = s->userdata);
|
||||||
|
|
||||||
/* Just hand this one over to the master sink */
|
/* Just hand this one over to the master sink */
|
||||||
u->sink_input->thread_info.requested_sink_latency = pa_sink_get_requested_latency(s);
|
u->sink_input->thread_info.requested_sink_latency = pa_sink_get_requested_latency_within_thread(s);
|
||||||
pa_sink_invalidate_requested_latency(u->master);
|
pa_sink_invalidate_requested_latency(u->master);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ static void sink_update_requested_latency(pa_sink *s) {
|
||||||
pa_assert_se(u = s->userdata);
|
pa_assert_se(u = s->userdata);
|
||||||
|
|
||||||
/* Just hand this one over to the master sink */
|
/* Just hand this one over to the master sink */
|
||||||
u->sink_input->thread_info.requested_sink_latency = pa_sink_get_requested_latency(s);
|
u->sink_input->thread_info.requested_sink_latency = pa_sink_get_requested_latency_within_thread(s);
|
||||||
pa_sink_invalidate_requested_latency(u->master);
|
pa_sink_invalidate_requested_latency(u->master);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue