[pulseaudio-commits] 2 commits - src/modules src/pulsecore

Arun Raghavan arun at kemper.freedesktop.org
Fri Nov 20 04:28:13 PST 2015


 src/modules/alsa/alsa-sink.c   |    3 +--
 src/modules/alsa/alsa-source.c |    3 +--
 src/pulsecore/source.c         |   18 ++++++++++++++----
 3 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit d084cf144a234a94de4fde8974bc957e8b721156
Author: Arun Raghavan <git at arunraghavan.net>
Date:   Mon Nov 16 19:37:20 2015 +0530

    alsa: Use helper function for byte conversion across sample specs

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 476188c..c5a72c3 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1020,8 +1020,7 @@ static int update_sw_params(struct userdata *u) {
 /* Called from IO Context on unsuspend or from main thread when creating sink */
 static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss,
                             bool in_thread) {
-    u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss),
-                                                    &u->sink->sample_spec);
+    u->tsched_watermark = pa_convert_size(tsched_watermark, ss, &u->sink->sample_spec);
 
     u->watermark_inc_step = pa_usec_to_bytes(TSCHED_WATERMARK_INC_STEP_USEC, &u->sink->sample_spec);
     u->watermark_dec_step = pa_usec_to_bytes(TSCHED_WATERMARK_DEC_STEP_USEC, &u->sink->sample_spec);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index d7d3eb5..4683dfe 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -913,8 +913,7 @@ static int update_sw_params(struct userdata *u) {
 /* Called from IO Context on unsuspend or from main thread when creating source */
 static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss,
                             bool in_thread) {
-    u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss),
-                                                    &u->source->sample_spec);
+    u->tsched_watermark = pa_convert_size(tsched_watermark, ss, &u->source->sample_spec);
 
     u->watermark_inc_step = pa_usec_to_bytes(TSCHED_WATERMARK_INC_STEP_USEC, &u->source->sample_spec);
     u->watermark_dec_step = pa_usec_to_bytes(TSCHED_WATERMARK_DEC_STEP_USEC, &u->source->sample_spec);

commit f5f677236436e030a56f890b45c43d03e1bc9544
Author: Arun Raghavan <git at arunraghavan.net>
Date:   Tue Nov 3 22:42:08 2015 +0530

    source: Deal with filter having more channels than the master
    
    Without this, we hit an assert because the channel count in
    new_reference (which was inherited from the master) is lower than the
    channel count of the filter.

diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index b553a2d..f4b96ab 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1573,7 +1573,7 @@ void pa_source_set_volume(
         bool send_msg,
         bool save) {
 
-    pa_cvolume new_reference_volume;
+    pa_cvolume new_reference_volume, root_real_volume;
     pa_source *root_source;
 
     pa_source_assert_ref(s);
@@ -1630,11 +1630,21 @@ void pa_source_set_volume(
         /* Ok, let's determine the new real volume */
         compute_real_volume(root_source);
 
-        /* Let's 'push' the reference volume if necessary */
-        pa_cvolume_merge(&new_reference_volume, &s->reference_volume, &root_source->real_volume);
-        /* If the source and its root don't have the same number of channels, we need to remap */
+        /* To propagate the reference volume from the filter to the root source,
+         * we first take the real volume from the root source and remap it to
+         * match the filter. Then, we merge in the reference volume from the
+         * filter on top of this, and remap it back to the root source channel
+         * count and map */
+        root_real_volume = root_source->real_volume;
+        /* First we remap root's real volume to filter channel count and map if needed */
+        if (s != root_source && !pa_channel_map_equal(&s->channel_map, &root_source->channel_map))
+            pa_cvolume_remap(&root_real_volume, &root_source->channel_map, &s->channel_map);
+        /* Then let's 'push' the reference volume if necessary */
+        pa_cvolume_merge(&new_reference_volume, &s->reference_volume, &root_real_volume);
+        /* If the source and its root don't have the same number of channels, we need to remap back */
         if (s != root_source && !pa_channel_map_equal(&s->channel_map, &root_source->channel_map))
             pa_cvolume_remap(&new_reference_volume, &s->channel_map, &root_source->channel_map);
+
         update_reference_volume(root_source, &new_reference_volume, &root_source->channel_map, save);
 
         /* Now that the reference volume is updated, we can update the streams'



More information about the pulseaudio-commits mailing list