summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/sink-input.c2
-rw-r--r--src/pulsecore/sink.c39
-rw-r--r--src/pulsecore/source.c21
3 files changed, 26 insertions, 36 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 0229918c..0d05b00a 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -819,7 +819,7 @@ pa_usec_t pa_sink_input_set_requested_latency_within_thread(pa_sink_input *i, pa
usec = i->sink->fixed_latency;
if (usec != (pa_usec_t) -1)
- usec = PA_CLAMP(usec, i->sink->thread_info.min_latency, i->sink->thread_info.max_latency);
+ usec = PA_CLAMP(usec, i->sink->thread_info.min_latency, i->sink->thread_info.max_latency);
i->thread_info.requested_sink_latency = usec;
pa_sink_invalidate_requested_latency(i->sink);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 06c8b520..3eb759cc 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -184,6 +184,12 @@ pa_sink* pa_sink_new(
return NULL;
}
+ if (!(flags & PA_SINK_HW_VOLUME_CTRL))
+ flags |= PA_SINK_DECIBEL_VOLUME;
+
+ if ((flags & PA_SINK_DECIBEL_VOLUME) && core->flat_volumes)
+ flags |= PA_SINK_FLAT_VOLUME;
+
s->parent.parent.free = sink_free;
s->parent.process_msg = pa_sink_process_msg;
@@ -263,7 +269,9 @@ pa_sink* pa_sink_new(
pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Monitor of %s", dn ? dn : s->name);
pa_proplist_sets(source_data.proplist, PA_PROP_DEVICE_CLASS, "monitor");
- s->monitor_source = pa_source_new(core, &source_data, 0);
+ s->monitor_source = pa_source_new(core, &source_data,
+ ((flags & PA_SINK_LATENCY) ? PA_SOURCE_LATENCY : 0) |
+ ((flags & PA_SINK_DYNAMIC_LATENCY) ? PA_SOURCE_DYNAMIC_LATENCY : 0));
pa_source_new_data_done(&source_data);
@@ -349,31 +357,18 @@ void pa_sink_put(pa_sink* s) {
pa_assert(s->rtpoll);
pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency);
- if (!(s->flags & PA_SINK_HW_VOLUME_CTRL)) {
- s->flags |= PA_SINK_DECIBEL_VOLUME;
- s->base_volume = PA_VOLUME_NORM;
- }
-
s->thread_info.soft_volume = s->soft_volume;
s->thread_info.soft_muted = s->muted;
- if (s->flags & PA_SINK_DECIBEL_VOLUME)
- s->n_volume_steps = PA_VOLUME_NORM+1;
-
- if (s->core->flat_volumes)
- if (s->flags & PA_SINK_DECIBEL_VOLUME)
- s->flags |= PA_SINK_FLAT_VOLUME;
-
- if (s->flags & PA_SINK_LATENCY)
- s->monitor_source->flags |= PA_SOURCE_LATENCY;
-
- if (s->flags & PA_SINK_DYNAMIC_LATENCY) {
- s->monitor_source->flags |= PA_SOURCE_DYNAMIC_LATENCY;
- s->fixed_latency = 0;
- } else if (s->fixed_latency <= 0)
- s->fixed_latency = DEFAULT_FIXED_LATENCY;
+ pa_assert((s->flags & PA_SINK_HW_VOLUME_CTRL) || (s->base_volume == PA_VOLUME_NORM && s->flags & PA_SINK_DECIBEL_VOLUME));
+ pa_assert(!(s->flags & PA_SINK_DECIBEL_VOLUME) || s->n_volume_steps == PA_VOLUME_NORM+1);
+ pa_assert(!(s->flags & PA_SINK_DYNAMIC_LATENCY) == (s->fixed_latency != 0));
+ pa_assert(!(s->flags & PA_SINK_LATENCY) == !(s->monitor_source->flags & PA_SOURCE_LATENCY));
+ pa_assert(!(s->flags & PA_SINK_DYNAMIC_LATENCY) == !(s->monitor_source->flags & PA_SOURCE_DYNAMIC_LATENCY));
- s->monitor_source->fixed_latency = s->fixed_latency;
+ pa_assert(s->monitor_source->fixed_latency == s->fixed_latency);
+ pa_assert(s->monitor_source->thread_info.min_latency == s->thread_info.min_latency);
+ pa_assert(s->monitor_source->thread_info.max_latency == s->thread_info.max_latency);
pa_assert_se(sink_set_state(s, PA_SINK_IDLE) == 0);
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index a772dc65..92387f60 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -174,6 +174,9 @@ pa_source* pa_source_new(
return NULL;
}
+ if (!(flags & PA_SOURCE_HW_VOLUME_CTRL))
+ flags |= PA_SOURCE_DECIBEL_VOLUME;
+
s->parent.parent.free = source_free;
s->parent.process_msg = pa_source_process_msg;
@@ -308,20 +311,12 @@ void pa_source_put(pa_source *s) {
pa_assert(s->rtpoll);
pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency);
- if (!(s->flags & PA_SOURCE_HW_VOLUME_CTRL)) {
- s->flags |= PA_SOURCE_DECIBEL_VOLUME;
-
- s->thread_info.soft_volume = s->soft_volume;
- s->thread_info.soft_muted = s->muted;
- }
-
- if (s->flags & PA_SOURCE_DECIBEL_VOLUME)
- s->n_volume_steps = PA_VOLUME_NORM+1;
+ s->thread_info.soft_volume = s->soft_volume;
+ s->thread_info.soft_muted = s->muted;
- if (s->flags & PA_SOURCE_DYNAMIC_LATENCY)
- s->fixed_latency = 0;
- else if (s->fixed_latency <= 0)
- s->fixed_latency = DEFAULT_FIXED_LATENCY;
+ pa_assert((s->flags & PA_SOURCE_HW_VOLUME_CTRL) || (s->base_volume == PA_VOLUME_NORM && s->flags & PA_SOURCE_DECIBEL_VOLUME));
+ pa_assert(!(s->flags & PA_SOURCE_DECIBEL_VOLUME) || s->n_volume_steps == PA_VOLUME_NORM+1);
+ pa_assert(!(s->flags & PA_SOURCE_DYNAMIC_LATENCY) == (s->fixed_latency != 0));
pa_assert_se(source_set_state(s, PA_SOURCE_IDLE) == 0);