mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-16 08:56:40 -05:00
core: liberalize 99a6a4 a bit
While flags should generally be initialized by passing them to
pa_{sink|source}_new() we make an exception for the volume related flags
which may be initilized afterwards, but before _put().
This commit is contained in:
parent
8d9c26e3b6
commit
7f767e5fe6
2 changed files with 17 additions and 9 deletions
|
|
@ -184,12 +184,6 @@ pa_sink* pa_sink_new(
|
||||||
return NULL;
|
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.parent.free = sink_free;
|
||||||
s->parent.process_msg = pa_sink_process_msg;
|
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->rtpoll);
|
||||||
pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency);
|
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_volume = s->soft_volume;
|
||||||
s->thread_info.soft_muted = s->muted;
|
s->thread_info.soft_muted = s->muted;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,9 +174,6 @@ pa_source* pa_source_new(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & PA_SOURCE_HW_VOLUME_CTRL))
|
|
||||||
flags |= PA_SOURCE_DECIBEL_VOLUME;
|
|
||||||
|
|
||||||
s->parent.parent.free = source_free;
|
s->parent.parent.free = source_free;
|
||||||
s->parent.process_msg = pa_source_process_msg;
|
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->rtpoll);
|
||||||
pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency);
|
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_volume = s->soft_volume;
|
||||||
s->thread_info.soft_muted = s->muted;
|
s->thread_info.soft_muted = s->muted;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue