[pulseaudio-commits] 6 commits - src/Makefile.am src/modules src/pulse src/pulsecore

Arun Raghavan arun at kemper.freedesktop.org
Wed Sep 14 01:50:25 PDT 2011


 src/Makefile.am                              |   13 +++++----
 src/modules/echo-cancel/module-echo-cancel.c |   33 +++++++++++++++-------
 src/modules/module-equalizer-sink.c          |   21 +++++++++++---
 src/modules/module-virtual-sink.c            |    2 -
 src/modules/module-virtual-source.c          |    2 -
 src/pulse/def.h                              |   39 +++++++++++++++------------
 src/pulse/stream.c                           |    2 -
 src/pulsecore/protocol-native.c              |    4 +-
 src/pulsecore/sink.c                         |    3 ++
 src/pulsecore/source.c                       |    3 ++
 10 files changed, 80 insertions(+), 42 deletions(-)

New commits:
commit 38be4a2d440ce51750b96727b638f947f75d69b6
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Wed Sep 14 13:22:15 2011 +0530

    echo-cancel: Use volume sharing by default
    
    Uses the shared volume infrastructure by default with an option to
    fallback on the old pretend-volume-sharing-that-kind-of-works if someone
    wants it that way.
    
    Users who keep left != right (or any sort of unbalanced channel volumes)
    will likely want to disable shared volumes since it will cause their
    master sink/source volume to be balanced.
    
    This really isn't a very pleasant scenario since users would need to
    manually set up echo cancellation in their config for this (until we
    have a way to store module configuration). That said, the majority case
    benefits from the volume sharing, so let's not wait for the
    configuration infrastructure to be ready to use this.

diff --git a/src/Makefile.am b/src/Makefile.am
index ca5d294..7f547cd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1734,7 +1734,7 @@ module_echo_cancel_la_SOURCES = \
 		modules/echo-cancel/adrian.c modules/echo-cancel/adrian.h
 module_echo_cancel_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_echo_cancel_la_LIBADD = $(MODULE_LIBADD) $(LIBSPEEX_LIBS)
-module_echo_cancel_la_CFLAGS = $(AM_CFLAGS) $(LIBSPEEX_CFLAGS)
+module_echo_cancel_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS) $(LIBSPEEX_CFLAGS)
 if HAVE_ORC
 ORC_SOURCE += modules/echo-cancel/adrian-aec
 nodist_module_echo_cancel_la_SOURCES = \
diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index a30b936..6c7828f 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -74,6 +74,7 @@ PA_MODULE_USAGE(
           "aec_args=<parameters for the AEC engine> "
           "save_aec=<save AEC data in /tmp> "
           "autoloaded=<set if this module is being loaded automatically> "
+          "use_volume_sharing=<yes or no> "
         ));
 
 /* NOTE: Make sure the enum and ec_table are maintained in the correct order */
@@ -212,6 +213,7 @@ static const char* const valid_modargs[] = {
     "aec_args",
     "save_aec",
     "autoloaded",
+    "use_volume_sharing",
     NULL
 };
 
@@ -1334,6 +1336,7 @@ int pa__init(pa_module*m) {
     pa_memchunk silence;
     pa_echo_canceller_method_t ec_method;
     uint32_t adjust_time_sec;
+    pa_bool_t use_volume_sharing = TRUE;
 
     pa_assert(m);
 
@@ -1366,6 +1369,11 @@ int pa__init(pa_module*m) {
     sink_ss = sink_master->sample_spec;
     sink_map = sink_master->channel_map;
 
+    if (pa_modargs_get_value_boolean(ma, "use_volume_sharing", &use_volume_sharing) < 0) {
+        pa_log("use_volume_sharing= expects a boolean argument");
+        goto fail;
+    }
+
     u = pa_xnew0(struct userdata, 1);
     if (!u) {
         pa_log("Failed to alloc userdata");
@@ -1450,8 +1458,8 @@ int pa__init(pa_module*m) {
         pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Echo-Cancel Source %s on %s", source_data.name, z ? z : source_master->name);
     }
 
-    u->source = pa_source_new(m->core, &source_data,
-                          (source_master->flags & (PA_SOURCE_LATENCY|PA_SOURCE_DYNAMIC_LATENCY)));
+    u->source = pa_source_new(m->core, &source_data, (source_master->flags & (PA_SOURCE_LATENCY | PA_SOURCE_DYNAMIC_LATENCY))
+                                                     | (use_volume_sharing ? PA_SOURCE_SHARE_VOLUME_WITH_MASTER : 0));
     pa_source_new_data_done(&source_data);
 
     if (!u->source) {
@@ -1462,11 +1470,13 @@ int pa__init(pa_module*m) {
     u->source->parent.process_msg = source_process_msg_cb;
     u->source->set_state = source_set_state_cb;
     u->source->update_requested_latency = source_update_requested_latency_cb;
-    pa_source_enable_decibel_volume(u->source, TRUE);
-    pa_source_set_get_volume_callback(u->source, source_get_volume_cb);
-    pa_source_set_set_volume_callback(u->source, source_set_volume_cb);
     pa_source_set_get_mute_callback(u->source, source_get_mute_cb);
     pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
+    if (!use_volume_sharing) {
+        pa_source_set_get_volume_callback(u->source, source_get_volume_cb);
+        pa_source_set_set_volume_callback(u->source, source_set_volume_cb);
+        pa_source_enable_decibel_volume(u->source, TRUE);
+    }
     u->source->userdata = u;
 
     pa_source_set_asyncmsgq(u->source, source_master->asyncmsgq);
@@ -1498,8 +1508,8 @@ int pa__init(pa_module*m) {
         pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Echo-Cancel Sink %s on %s", sink_data.name, z ? z : sink_master->name);
     }
 
-    u->sink = pa_sink_new(m->core, &sink_data,
-                          (sink_master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY)));
+    u->sink = pa_sink_new(m->core, &sink_data, (sink_master->flags & (PA_SINK_LATENCY | PA_SINK_DYNAMIC_LATENCY))
+                                               | (use_volume_sharing ? PA_SINK_SHARE_VOLUME_WITH_MASTER : 0));
     pa_sink_new_data_done(&sink_data);
 
     if (!u->sink) {
@@ -1511,9 +1521,11 @@ int pa__init(pa_module*m) {
     u->sink->set_state = sink_set_state_cb;
     u->sink->update_requested_latency = sink_update_requested_latency_cb;
     u->sink->request_rewind = sink_request_rewind_cb;
-    pa_sink_enable_decibel_volume(u->sink, TRUE);
-    pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
     pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
+    if (!use_volume_sharing) {
+        pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
+        pa_sink_enable_decibel_volume(u->sink, TRUE);
+    }
     u->sink->userdata = u;
 
     pa_sink_set_asyncmsgq(u->sink, sink_master->asyncmsgq);
@@ -1587,7 +1599,8 @@ int pa__init(pa_module*m) {
     u->sink_input->state_change = sink_input_state_change_cb;
     u->sink_input->may_move_to = sink_input_may_move_to_cb;
     u->sink_input->moving = sink_input_moving_cb;
-    u->sink_input->volume_changed = sink_input_volume_changed_cb;
+    if (!use_volume_sharing)
+        u->sink_input->volume_changed = sink_input_volume_changed_cb;
     u->sink_input->mute_changed = sink_input_mute_changed_cb;
     u->sink_input->userdata = u;
 

commit ec099f93067f88679fdc5ab5b077bde5e2a30e2d
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Wed Sep 14 13:20:59 2011 +0530

    equalizer: Use volume sharing by default
    
    Uses the shared volume infrastructure by default with an option to
    fallback on the old pretend-volume-sharing-that-kind-of-works if someone
    wants it that way.

diff --git a/src/Makefile.am b/src/Makefile.am
index b89e7d8..ca5d294 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1464,7 +1464,7 @@ module_ladspa_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_ladspa_sink_la_LIBADD = $(MODULE_LIBADD) $(LIBLTDL)
 
 module_equalizer_sink_la_SOURCES = modules/module-equalizer-sink.c
-module_equalizer_sink_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) $(FFTW_CFLAGS)
+module_equalizer_sink_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS) $(DBUS_CFLAGS) $(FFTW_CFLAGS)
 module_equalizer_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_equalizer_sink_la_LIBADD = $(MODULE_LIBADD) $(DBUS_LIBS) $(FFTW_LIBS)
 
diff --git a/src/modules/module-equalizer-sink.c b/src/modules/module-equalizer-sink.c
index 19b679b..e0587fe 100644
--- a/src/modules/module-equalizer-sink.c
+++ b/src/modules/module-equalizer-sink.c
@@ -81,6 +81,7 @@ PA_MODULE_USAGE(
           "channels=<number of channels> "
           "channel_map=<channel map> "
           "autoloaded=<set if this module is being loaded automatically> "
+          "use_volume_sharing=<yes or no> "
          ));
 
 #define MEMBLOCKQ_MAXLENGTH (16*1024*1024)
@@ -139,6 +140,7 @@ static const char* const valid_modargs[] = {
     "channels",
     "channel_map",
     "autoloaded",
+    "use_volume_sharing",
     NULL
 };
 
@@ -1083,6 +1085,7 @@ int pa__init(pa_module*m) {
     unsigned c;
     float *H;
     unsigned a_i;
+    pa_bool_t use_volume_sharing = TRUE;
 
     pa_assert(m);
 
@@ -1106,6 +1109,11 @@ int pa__init(pa_module*m) {
 
     fs = pa_frame_size(&ss);
 
+    if (pa_modargs_get_value_boolean(ma, "use_volume_sharing", &use_volume_sharing) < 0) {
+        pa_log("use_volume_sharing= expects a boolean argument");
+        goto fail;
+    }
+
     u = pa_xnew0(struct userdata, 1);
     u->module = m;
     m->userdata = u;
@@ -1179,8 +1187,8 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
-    u->sink = pa_sink_new(m->core, &sink_data,
-                          (master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY)));
+    u->sink = pa_sink_new(m->core, &sink_data, (master->flags & (PA_SINK_LATENCY | PA_SINK_DYNAMIC_LATENCY))
+                                               | (use_volume_sharing ? PA_SINK_SHARE_VOLUME_WITH_MASTER : 0));
     pa_sink_new_data_done(&sink_data);
 
     if (!u->sink) {
@@ -1192,9 +1200,11 @@ int pa__init(pa_module*m) {
     u->sink->set_state = sink_set_state_cb;
     u->sink->update_requested_latency = sink_update_requested_latency_cb;
     u->sink->request_rewind = sink_request_rewind_cb;
-    pa_sink_enable_decibel_volume(u->sink, TRUE);
-    pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
     pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
+    if (!use_volume_sharing) {
+        pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
+        pa_sink_enable_decibel_volume(u->sink, TRUE);
+    }
     u->sink->userdata = u;
 
     u->input_q = pa_memblockq_new(0,  MEMBLOCKQ_MAXLENGTH, 0, fs, 1, 1, 0, &u->sink->silence);
@@ -1235,7 +1245,8 @@ int pa__init(pa_module*m) {
     u->sink_input->state_change = sink_input_state_change_cb;
     u->sink_input->may_move_to = sink_input_may_move_to_cb;
     u->sink_input->moving = sink_input_moving_cb;
-    u->sink_input->volume_changed = sink_input_volume_changed_cb;
+    if (!use_volume_sharing)
+        u->sink_input->volume_changed = sink_input_volume_changed_cb;
     u->sink_input->mute_changed = sink_input_mute_changed_cb;
     u->sink_input->userdata = u;
 

commit baccd26b6a4598f7f384a6d2a802f8f40dbee566
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Wed Sep 14 13:18:48 2011 +0530

    virtual: Make volume sharing on by default
    
    People who use this code (i.e. mostly filters) would presumably want
    volume sharing on by default.

diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c
index 34c4ae8..dd3de86 100644
--- a/src/modules/module-virtual-sink.c
+++ b/src/modules/module-virtual-sink.c
@@ -482,7 +482,7 @@ int pa__init(pa_module*m) {
     pa_sink *master=NULL;
     pa_sink_input_new_data sink_input_data;
     pa_sink_new_data sink_data;
-    pa_bool_t use_volume_sharing = FALSE;
+    pa_bool_t use_volume_sharing = TRUE;
     pa_bool_t force_flat_volume = FALSE;
     pa_memchunk silence;
 
diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c
index 7530975..00a4b65 100644
--- a/src/modules/module-virtual-source.c
+++ b/src/modules/module-virtual-source.c
@@ -497,7 +497,7 @@ int pa__init(pa_module*m) {
     pa_source *master=NULL;
     pa_source_output_new_data source_output_data;
     pa_source_new_data source_data;
-    pa_bool_t use_volume_sharing = FALSE;
+    pa_bool_t use_volume_sharing = TRUE;
     pa_bool_t force_flat_volume = FALSE;
 
     /* optional for uplink_sink */

commit 2ef7bc6a8092731e2370cd28d34cb932c191e967
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Wed Sep 14 13:10:52 2011 +0530

    volume: Handle varying channel count for shared volumes
    
    This handles the case where a virtual sink/source and it's master have
    different channel counts. The solution is not ideal because if the
    former has fewer channels and the master has channel volumes that are
    not all at the same level, it will lose this information and have all
    channels at the same level.
    
    This is not just a theoretical problem, since module-echo-cancel
    prefers a mono virtual source/sink and will usually be sitting on top of
    a stereo ALSA source/sink.
    
    That said, I don't really see a good solution to this problem, so the
    idea is to make volume sharing optional (on by default) in
    module-echo-cancel, so that the few people who care can then disable it
    if they so desire.

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 0350284..a29d61d 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1863,6 +1863,9 @@ void pa_sink_set_volume(
 
         /* Let's 'push' the reference volume if necessary */
         pa_cvolume_merge(&new_reference_volume, &s->reference_volume, &root_sink->real_volume);
+        /* If the sink and it's root don't have the same number of channels, we need to remap */
+        if (s != root_sink && !pa_channel_map_equal(&s->channel_map, &root_sink->channel_map))
+            pa_cvolume_remap(&new_reference_volume, &s->channel_map, &root_sink->channel_map);
         update_reference_volume(root_sink, &new_reference_volume, &root_sink->channel_map, save);
 
         /* Now that the reference volume is updated, we can update the streams'
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 84c8edc..5f57265 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1439,6 +1439,9 @@ void pa_source_set_volume(
 
         /* 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 it's root don't have the same number of channels, we need to remap */
+        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'

commit a9c85074cbf6903e5eb9789f470f6c2c3ee40734
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Wed Sep 14 07:24:19 2011 +0530

    def: Hide server-side sink/source flags
    
    This makes sure that sink/source flags that are used on the server side
    only are not leaked to clients.

diff --git a/src/Makefile.am b/src/Makefile.am
index 4009deb..b89e7d8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,6 +48,7 @@ AM_CFLAGS = \
 	$(PTHREAD_CFLAGS) \
 	-DPA_ALSA_PATHS_DIR=\"$(alsapathsdir)\" \
 	-DPA_ALSA_PROFILE_SETS_DIR=\"$(alsaprofilesetsdir)\"
+SERVER_CFLAGS = -D__INCLUDED_FROM_PULSE_AUDIO
 
 AM_LIBADD = $(PTHREAD_LIBS) $(INTLLIBS)
 AM_LDADD = $(PTHREAD_LIBS) $(INTLLIBS)
@@ -819,7 +820,7 @@ libpulsecore_ at PA_MAJORMINOR@_la_SOURCES = \
 		pulsecore/time-smoother.c pulsecore/time-smoother.h \
 		pulsecore/database.h
 
-libpulsecore_ at PA_MAJORMINOR@_la_CFLAGS = $(AM_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(LIBSNDFILE_CFLAGS) $(WINSOCK_CFLAGS)
+libpulsecore_ at PA_MAJORMINOR@_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(LIBSNDFILE_CFLAGS) $(WINSOCK_CFLAGS)
 libpulsecore_ at PA_MAJORMINOR@_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
 libpulsecore_ at PA_MAJORMINOR@_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSPEEX_LIBS) $(LIBSNDFILE_LIBS) $(WINSOCK_LIBS) $(LTLIBICONV) libpulsecommon- at PA_MAJORMINOR@.la libpulse.la libpulsecore-foreign.la
 
@@ -914,7 +915,7 @@ libprotocol_http_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
 libprotocol_http_la_LIBADD = $(AM_LIBADD) libpulsecore- at PA_MAJORMINOR@.la libpulsecommon- at PA_MAJORMINOR@.la libpulse.la
 
 libprotocol_native_la_SOURCES = pulsecore/protocol-native.c pulsecore/protocol-native.h pulsecore/native-common.h
-libprotocol_native_la_CFLAGS = $(AM_CFLAGS)
+libprotocol_native_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS)
 libprotocol_native_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
 libprotocol_native_la_LIBADD = $(AM_LIBADD) libpulsecore- at PA_MAJORMINOR@.la libpulsecommon- at PA_MAJORMINOR@.la libpulse.la
 if HAVE_DBUS
@@ -1485,10 +1486,12 @@ module_loopback_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_loopback_la_LIBADD = $(MODULE_LIBADD)
 
 module_virtual_sink_la_SOURCES = modules/module-virtual-sink.c
+module_virtual_sink_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS)
 module_virtual_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_virtual_sink_la_LIBADD = $(MODULE_LIBADD)
 
 module_virtual_source_la_SOURCES = modules/module-virtual-source.c
+module_virtual_source_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS)
 module_virtual_source_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_virtual_source_la_LIBADD = $(MODULE_LIBADD)
 
@@ -1548,7 +1551,7 @@ libalsa_util_la_SOURCES = \
 		modules/reserve-wrap.c modules/reserve-wrap.h
 libalsa_util_la_LDFLAGS = -avoid-version
 libalsa_util_la_LIBADD = $(MODULE_LIBADD) $(ASOUNDLIB_LIBS)
-libalsa_util_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS)
+libalsa_util_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS) $(ASOUNDLIB_CFLAGS)
 
 if HAVE_HAL
 libalsa_util_la_SOURCES += modules/hal-util.h modules/hal-util.c
diff --git a/src/pulse/def.h b/src/pulse/def.h
index 5e2626c..f43e864 100644
--- a/src/pulse/def.h
+++ b/src/pulse/def.h
@@ -753,24 +753,26 @@ typedef enum pa_sink_flags {
     /**< The latency can be adjusted dynamically depending on the
      * needs of the connected streams. \since 0.9.15 */
 
-    PA_SINK_DEFERRED_VOLUME = 0x0100U,
-    /**< The HW volume changes are syncronized with SW volume.
-     * \since 1.0 */
+    PA_SINK_SET_FORMATS = 0x0100U,
+    /**< The sink allows setting what formats are supported by the connected
+     * hardware. The actual functionality to do this might be provided by an
+     * extension. \since 1.0 */
 
+#ifdef __INCLUDED_FROM_PULSE_AUDIO
 /** \cond fulldocs */
     /* PRIVATE: Server-side values -- do not try to use these at client-side.
      * The server will filter out these flags anyway, so you should never see
      * these flags in sinks. */
 
-    PA_SINK_SHARE_VOLUME_WITH_MASTER = 0x0200U,
+    PA_SINK_SHARE_VOLUME_WITH_MASTER = 0x1000000U,
     /**< This sink shares the volume with the master sink (used by some filter
      * sinks). */
+
+    PA_SINK_DEFERRED_VOLUME = 0x2000000U,
+    /**< The HW volume changes are syncronized with SW volume. */
 /** \endcond */
+#endif
 
-    PA_SINK_SET_FORMATS = 0x0400U,
-    /**< The sink allows setting what formats are supported by the connected
-     * hardware. The actual functionality to do this might be provided by an
-     * extension. \since 1.0 */
 } pa_sink_flags_t;
 
 /** \cond fulldocs */
@@ -782,9 +784,10 @@ typedef enum pa_sink_flags {
 #define PA_SINK_DECIBEL_VOLUME PA_SINK_DECIBEL_VOLUME
 #define PA_SINK_FLAT_VOLUME PA_SINK_FLAT_VOLUME
 #define PA_SINK_DYNAMIC_LATENCY PA_SINK_DYNAMIC_LATENCY
-#define PA_SINK_DEFERRED_VOLUME PA_SINK_DEFERRED_VOLUME
-#define PA_SINK_SHARE_VOLUME_WITH_MASTER PA_SINK_SHARE_VOLUME_WITH_MASTER
 #define PA_SINK_SET_FORMATS PA_SINK_SET_FORMATS
+#ifdef __INCLUDED_FROM_PULSE_AUDIO
+#define PA_SINK_CLIENT_FLAGS_MASK 0xFFFFFF
+#endif
 
 /** \endcond */
 
@@ -869,18 +872,19 @@ typedef enum pa_source_flags {
     /**< This source is in flat volume mode, i.e. always the maximum of
      * the volume of all connected outputs. \since 1.0 */
 
-    PA_SOURCE_DEFERRED_VOLUME = 0x0100U,
-    /**< The HW volume changes are syncronized with SW volume.
-     * \since 1.0 */
-
+#ifdef __INCLUDED_FROM_PULSE_AUDIO
 /** \cond fulldocs */
     /* PRIVATE: Server-side values -- do not try to use these at client-side.
      * The server will filter out these flags anyway, so you should never see
      * these flags in sources. */
 
-    PA_SOURCE_SHARE_VOLUME_WITH_MASTER = 0x0200U,
+    PA_SOURCE_SHARE_VOLUME_WITH_MASTER = 0x1000000U,
     /**< This source shares the volume with the master source (used by some filter
      * sources). */
+
+    PA_SOURCE_DEFERRED_VOLUME = 0x2000000U,
+    /**< The HW volume changes are syncronized with SW volume. */
+#endif
 } pa_source_flags_t;
 
 /** \cond fulldocs */
@@ -892,8 +896,9 @@ typedef enum pa_source_flags {
 #define PA_SOURCE_DECIBEL_VOLUME PA_SOURCE_DECIBEL_VOLUME
 #define PA_SOURCE_DYNAMIC_LATENCY PA_SOURCE_DYNAMIC_LATENCY
 #define PA_SOURCE_FLAT_VOLUME PA_SOURCE_FLAT_VOLUME
-#define PA_SOURCE_DEFERRED_VOLUME PA_SOURCE_DEFERRED_VOLUME
-#define PA_SOURCE_SHARE_VOLUME_WITH_MASTER PA_SOURCE_SHARE_VOLUME_WITH_MASTER
+#ifdef __INCLUDED_FROM_PULSE_AUDIO
+#define PA_SOURCE_CLIENT_FLAGS_MASK 0xFFFFFF
+#endif
 
 /** \endcond */
 
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 3cffecb..e871478 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -3066,7 +3066,7 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin
         PA_TAG_STRING, sink->monitor_source ? sink->monitor_source->name : NULL,
         PA_TAG_USEC, pa_sink_get_latency(sink),
         PA_TAG_STRING, sink->driver,
-        PA_TAG_U32, sink->flags & ~PA_SINK_SHARE_VOLUME_WITH_MASTER,
+        PA_TAG_U32, sink->flags & PA_SINK_CLIENT_FLAGS_MASK,
         PA_TAG_INVALID);
 
     if (c->version >= 13) {
@@ -3136,7 +3136,7 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s
         PA_TAG_STRING, source->monitor_of ? source->monitor_of->name : NULL,
         PA_TAG_USEC, pa_source_get_latency(source),
         PA_TAG_STRING, source->driver,
-        PA_TAG_U32, source->flags,
+        PA_TAG_U32, source->flags & PA_SOURCE_CLIENT_FLAGS_MASK,
         PA_TAG_INVALID);
 
     if (c->version >= 13) {

commit ec4f2564931ec732f634ce892a360b1c195133fa
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Wed Sep 14 08:32:40 2011 +0530

    stream: Relax assert for extended API
    
    For some reason this assert wasn't triggered earlier -- we shouldn't be
    looking at the stream sample_spec if the formats API is used.

diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index e7e3211..ec88bf1 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -1213,7 +1213,7 @@ static int create_stream(
 
     PA_CHECK_VALIDITY(s->context, direction == PA_STREAM_PLAYBACK || !(flags & (PA_STREAM_START_MUTED)), PA_ERR_INVALID);
     PA_CHECK_VALIDITY(s->context, direction == PA_STREAM_RECORD || !(flags & (PA_STREAM_PEAK_DETECT)), PA_ERR_INVALID);
-    PA_CHECK_VALIDITY(s->context, !volume || (pa_sample_spec_valid(&s->sample_spec) && volume->channels == s->sample_spec.channels), PA_ERR_INVALID);
+    PA_CHECK_VALIDITY(s->context, !volume || s->n_formats || (pa_sample_spec_valid(&s->sample_spec) && volume->channels == s->sample_spec.channels), PA_ERR_INVALID);
     PA_CHECK_VALIDITY(s->context, !sync_stream || (direction == PA_STREAM_PLAYBACK && sync_stream->direction == PA_STREAM_PLAYBACK), PA_ERR_INVALID);
     PA_CHECK_VALIDITY(s->context, (flags & (PA_STREAM_ADJUST_LATENCY|PA_STREAM_EARLY_REQUESTS)) != (PA_STREAM_ADJUST_LATENCY|PA_STREAM_EARLY_REQUESTS), PA_ERR_INVALID);
 



More information about the pulseaudio-commits mailing list