summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pulsecore/sink.c16
-rw-r--r--src/pulsecore/source.c10
2 files changed, 17 insertions, 9 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 0f594daf..67bdbb68 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -184,12 +184,6 @@ 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;
@@ -357,6 +351,16 @@ void pa_sink_put(pa_sink* s) {
pa_assert(s->rtpoll);
pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency);
+ /* Generally, flags should be initialized via pa_sink_new(). As a
+ * special exception we allow volume related flags to be set
+ * between _new() and _put(). */
+
+ if (!(s->flags & PA_SINK_HW_VOLUME_CTRL))
+ s->flags |= PA_SINK_DECIBEL_VOLUME;
+
+ if ((s->flags & PA_SINK_DECIBEL_VOLUME) && s->core->flat_volumes)
+ s->flags |= PA_SINK_FLAT_VOLUME;
+
s->thread_info.soft_volume = s->soft_volume;
s->thread_info.soft_muted = s->muted;
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 47bc5fb2..8aeb5606 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -174,9 +174,6 @@ 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;
@@ -311,6 +308,13 @@ void pa_source_put(pa_source *s) {
pa_assert(s->rtpoll);
pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency);
+ /* Generally, flags should be initialized via pa_source_new(). As
+ * a special exception we allow volume related flags to be set
+ * between _new() and _put(). */
+
+ 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;