[pulseaudio-commits] Branch 'next' - src/modules

2018-06-12 Thread Tanu Kaskinen
 src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit fd59eb33d3284c662370b425f5e45b838ddc3a21
Author: Nazar Mokrynskyi 
Date:   Fri Jun 1 13:38:14 2018 +0300

alsa-mixer: Don't move LFE in 2.1 and 4.1 modes on SB Omni Surround 5.1

A bit hacky approach, but it allows to preserve LFE output position
even in reduced output modes 2.1 and 4.1.

Signed-off-by: Nazar Mokrynskyi 

diff --git a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf 
b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
index 11985bb3..d5d1d653 100644
--- a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
+++ b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
@@ -42,7 +42,7 @@ direction = output
 
 [Mapping analog-surround-21]
 device-strings = surround51:%f
-channel-map = front-left,front-right,lfe
+channel-map = front-left,front-right,aux1,aux2,aux3,lfe
 paths-output = analog-output
 direction = output
 
@@ -54,7 +54,7 @@ direction = output
 
 [Mapping analog-surround-41]
 device-strings = surround51:%f
-channel-map = front-left,front-right,rear-left,rear-right,lfe
+channel-map = front-left,front-right,rear-left,rear-right,aux1,lfe
 paths-output = analog-output
 direction = output
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2018-06-11 Thread Tanu Kaskinen
 src/modules/alsa/alsa-mixer.c|1 +
 src/modules/alsa/mixer/profile-sets/default.conf |   18 ++
 2 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 51aa5c646ed7648b9db1febc0a04c37d13368522
Author: Tanu Kaskinen 
Date:   Fri Jun 1 11:24:01 2018 +0300

alsa-mixer: make the mono mapping a fallback only

If a sound card doesn't have the "front" device defined for it, we have
to use the "hw" device for stereo. Not so long ago, the analog-stereo
mapping had "hw:%f" in its device-strings and everything worked great,
except that it caused trouble with the Intel HDMI LPE driver that uses
the first "hw" device for HDMI, and we were incorrectly detecting it as
an analog device. That problem was fixed in commit ea3ebd09, which
removed "hw:%f" from analog-stereo and added a new stereo fallback
mapping for "hw".

Now the problem is that if a sound card doesn't have the "front" device
defined for it, and it supports both mono and stereo, only the mono
mapping is used, because the stereo mapping is only a fallback. This
patch makes the mono mapping a fallback too, so the mono mapping is used
only if there's absolutely nothing else that works.

This can cause trouble at least in theory. Maybe someone actually wants
to use mono output on a card that supports both mono and stereo. But
that seems quite unlikely.

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index b8c2bc72..460a8847 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -3992,6 +3992,7 @@ static int mapping_verify(pa_alsa_mapping *m, const 
pa_channel_map *bonus) {
 static const struct description_map well_known_descriptions[] = {
 { "analog-mono",N_("Analog Mono") },
 { "analog-stereo",  N_("Analog Stereo") },
+{ "mono-fallback",  N_("Mono") },
 { "stereo-fallback",N_("Stereo") },
 /* Note: Not translated to "Analog Stereo Input", because the source
  * name gets "Input" appended to it automatically, so adding "Input"
diff --git a/src/modules/alsa/mixer/profile-sets/default.conf 
b/src/modules/alsa/mixer/profile-sets/default.conf
index f5093830..34c51bc5 100644
--- a/src/modules/alsa/mixer/profile-sets/default.conf
+++ b/src/modules/alsa/mixer/profile-sets/default.conf
@@ -101,13 +101,6 @@
 [General]
 auto-profiles = yes
 
-[Mapping analog-mono]
-device-strings = hw:%f
-channel-map = mono
-paths-output = analog-output analog-output-lineout analog-output-speaker 
analog-output-headphones analog-output-headphones-2 analog-output-mono
-paths-input = analog-input-front-mic analog-input-rear-mic 
analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic 
analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner 
analog-input-fm analog-input-mic-line analog-input-headset-mic
-priority = 7
-
 [Mapping analog-stereo]
 device-strings = front:%f
 channel-map = left,right
@@ -115,7 +108,7 @@ paths-output = analog-output analog-output-lineout 
analog-output-speaker analog-
 paths-input = analog-input-front-mic analog-input-rear-mic 
analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic 
analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner 
analog-input-fm analog-input-mic-line analog-input-headphone-mic 
analog-input-headset-mic
 priority = 15
 
-# If everything else fails, try to use hw:0 as a stereo device.
+# If everything else fails, try to use hw:0 as a stereo device...
 [Mapping stereo-fallback]
 device-strings = hw:%f
 fallback = yes
@@ -124,6 +117,15 @@ paths-output = analog-output analog-output-lineout 
analog-output-speaker analog-
 paths-input = analog-input-front-mic analog-input-rear-mic 
analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic 
analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner 
analog-input-fm analog-input-mic-line analog-input-headphone-mic 
analog-input-headset-mic
 priority = 1
 
+# ...and if even that fails, try to use hw:0 as a mono device.
+[Mapping mono-fallback]
+device-strings = hw:%f
+fallback = yes
+channel-map = mono
+paths-output = analog-output analog-output-lineout analog-output-speaker 
analog-output-headphones analog-output-headphones-2 analog-output-mono
+paths-input = analog-input-front-mic analog-input-rear-mic 
analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic 
analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner 
analog-input-fm analog-input-mic-line analog-input-headset-mic
+priority = 1
+
 [Mapping analog-surround-21]
 device-strings = surround21:%f
 channel-map = front-left,front-right,lfe

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinf

[pulseaudio-commits] Branch 'next' - src/modules

2018-05-19 Thread Tanu Kaskinen
 src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf |   90 --
 1 file changed, 72 insertions(+), 18 deletions(-)

New commits:
commit becf24d5addbad06914c3bc89fc4ba5f128a
Author: Nazar Mokrynskyi 
Date:   Wed May 9 01:51:23 2018 +0300

alsa-mixer: More output modes for SB Omni Surround 5.1 and cleanup

There are only stereo and 5.1 output modes supported natively on this
sound card, but with this config more modes like 2.1, 4.0, 4.1 and 5.0
are now exposed. Also profiles list is cleaner now with all profiles
explicitly specified.

Last thing is removed support for microphone on Linux kernels older than
4.3-rc1, which shouldn't be an issue with future version of PulseAudio
likely be installed on newer kernels anyway.

Signed-off-by: Nazar Mokrynskyi 

diff --git a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf 
b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
index d5922da7..11985bb3 100644
--- a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
+++ b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
@@ -15,44 +15,98 @@
 
 ; Creative Sound Blaster Omni Surround 5.1
 ;
-; This sound card have Mic/Line in at hw:%f,1,0 on Linux prior to 4.3-rc1,
-; but starting from Linux 4.3-rc1 Mic/Line is at hw:%f,0,0
-; This config supports both cases.
-; Also by default there are some non-existing (physically) inputs
-; and outputs that are not present here.
-; And finally officially supported modes are stereo and 5.1 + stereo S/PDIF,
-; so only these modes included.
+; This config supports Linux 4.3-rc1+.
+; By default there are some non-existing (physically) inputs and outputs that
+; are not present in this config.
+; Also in addition to natively supported modes (such as stereo, 5.1 and stereo
+; S/PDIF) following useful output modes are added: 2.1, 4.0, 4.1 and 5.0.
+;
+; NOTE: in 2.1 and 4.1 physical LFE output will be different than in 5.1 mode.
 ;
 ; See default.conf for an explanation on the directives used here.
 
 [General]
-auto-profiles = yes
+auto-profiles = no
+
+[Mapping analog-stereo-input]
+device-strings = hw:%f
+channel-map = left,right
+paths-input = analog-input-mic analog-input-linein
+direction = input
 
 [Mapping analog-stereo-output]
 device-strings = front:%f
 channel-map = left,right
 paths-output = analog-output
-priority = 10
 direction = output
 
-; Linux 4.2.x- have microphone input as device 1
-; While Linux 4.3-rc1+ have microphone input as device 0
-[Mapping analog-stereo-input]
-device-strings = hw:%f hw:%f,1,0
-paths-input = analog-input-mic analog-input-linein
-channel-map = left,right
-direction = input
+[Mapping analog-surround-21]
+device-strings = surround51:%f
+channel-map = front-left,front-right,lfe
+paths-output = analog-output
+direction = output
+
+[Mapping analog-surround-40]
+device-strings = surround51:%f
+channel-map = front-left,front-right,rear-left,rear-right
+paths-output = analog-output
+direction = output
+
+[Mapping analog-surround-41]
+device-strings = surround51:%f
+channel-map = front-left,front-right,rear-left,rear-right,lfe
+paths-output = analog-output
+direction = output
+
+[Mapping analog-surround-50]
+device-strings = surround51:%f
+channel-map = front-left,front-right,rear-left,rear-right,front-center
+paths-output = analog-output
+direction = output
 
 [Mapping analog-surround-51]
 device-strings = surround51:%f
 channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
 paths-output = analog-output
-priority = 9
 direction = output
 
 [Mapping iec958-stereo]
 device-strings = iec958:%f
 channel-map = left,right
 paths-output = iec958-stereo-output
-priority = 5
 direction = output
+
+[Profile output:analog-stereo-output+input:analog-stereo-input]
+output-mappings = analog-stereo-output
+input-mappings = analog-stereo-input
+priority = 7
+
+[Profile output:analog-surround-21+input:analog-stereo-input]
+output-mappings = analog-surround-21
+input-mappings = analog-stereo-input
+priority = 6
+
+[Profile output:analog-surround-40+input:analog-stereo-input]
+output-mappings = analog-surround-40
+input-mappings = analog-stereo-input
+priority = 5
+
+[Profile output:analog-surround-41+input:analog-stereo-input]
+output-mappings = analog-surround-41
+input-mappings = analog-stereo-input
+priority = 4
+
+[Profile output:analog-surround-50+input:analog-stereo-input]
+output-mappings = analog-surround-50
+input-mappings = analog-stereo-input
+priority = 3
+
+[Profile output:analog-surround-51+input:analog-stereo-input]
+output-mappings = analog-surround-51
+input-mappings = analog-stereo-input
+priority = 2
+
+[Profile output:iec958-stereo+input:analog-stereo-input]
+output-mappings = iec958-stereo
+input-mappings = analog-stereo-input
+priority = 1

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudi

[pulseaudio-commits] Branch 'next' - src/modules

2018-05-04 Thread Tanu Kaskinen
 src/modules/rtp/module-rtp-send.c |5 -
 1 file changed, 5 deletions(-)

New commits:
commit f1f7196a5754596ad2eccb51044a0b7f70707cb9
Author: Sangchul Lee 
Date:   Fri May 4 01:27:21 2018 +0900

rtp-send: remove dead code

Signed-off-by: Sangchul Lee 

diff --git a/src/modules/rtp/module-rtp-send.c 
b/src/modules/rtp/module-rtp-send.c
index ceb6df50..61900c01 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -514,11 +514,6 @@ fail:
 if (sap_fd >= 0)
 pa_close(sap_fd);
 
-if (o) {
-pa_source_output_unlink(o);
-pa_source_output_unref(o);
-}
-
 return -1;
 }
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules src/pulsecore

2018-03-23 Thread Tanu Kaskinen
 src/modules/module-stream-restore.c |7 ++-
 src/pulsecore/dbus-util.c   |7 ++-
 src/pulsecore/protocol-dbus.c   |8 ++--
 3 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit 12cf640d31ac865a47cd8e1fc48768d8b7553a59
Author: Jungsup Lee 
Date:   Fri Mar 23 17:26:36 2018 +0900

Fix memory leaks

The returned string of the dbus_message_iter_get_signature() must be
freed with dbus_free().

diff --git a/src/modules/module-stream-restore.c 
b/src/modules/module-stream-restore.c
index 7ee53340..e562e4ed 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -346,14 +346,19 @@ static void dbus_entry_free(struct dbus_entry *de) {
 static int get_volume_arg(DBusConnection *conn, DBusMessage *msg, 
DBusMessageIter *iter, pa_channel_map *map, pa_cvolume *vol) {
 DBusMessageIter array_iter;
 DBusMessageIter struct_iter;
+char *signature;
 
 pa_assert(conn);
 pa_assert(msg);
 pa_assert(iter);
-pa_assert(pa_streq(dbus_message_iter_get_signature(iter), "a(uu)"));
 pa_assert(map);
 pa_assert(vol);
 
+pa_assert_se(signature = dbus_message_iter_get_signature(iter));
+pa_assert(pa_streq(signature, "a(uu)"));
+
+dbus_free(signature);
+
 pa_channel_map_init(map);
 pa_cvolume_init(vol);
 
diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c
index 80e2866e..d5d5f7e1 100644
--- a/src/pulsecore/dbus-util.c
+++ b/src/pulsecore/dbus-util.c
@@ -735,6 +735,7 @@ void 
pa_dbus_append_proplist_variant_dict_entry(DBusMessageIter *dict_iter, cons
 pa_proplist *pa_dbus_get_proplist_arg(DBusConnection *c, DBusMessage *msg, 
DBusMessageIter *iter) {
 DBusMessageIter dict_iter;
 DBusMessageIter dict_entry_iter;
+char *signature;
 pa_proplist *proplist = NULL;
 const char *key = NULL;
 const uint8_t *value = NULL;
@@ -743,7 +744,11 @@ pa_proplist *pa_dbus_get_proplist_arg(DBusConnection *c, 
DBusMessage *msg, DBusM
 pa_assert(c);
 pa_assert(msg);
 pa_assert(iter);
-pa_assert(pa_streq(dbus_message_iter_get_signature(iter), "a{say}"));
+
+pa_assert(signature = dbus_message_iter_get_signature(iter));
+pa_assert_se(pa_streq(signature, "a{say}"));
+
+dbus_free(signature);
 
 proplist = pa_proplist_new();
 
diff --git a/src/pulsecore/protocol-dbus.c b/src/pulsecore/protocol-dbus.c
index 59afc1ab..31a48d19 100644
--- a/src/pulsecore/protocol-dbus.c
+++ b/src/pulsecore/protocol-dbus.c
@@ -313,7 +313,7 @@ struct call_info {
 const char *property_interface; /* The interface argument of a property 
call is stored here. */
 pa_dbus_property_handler *property_handler;
 const char *expected_property_sig; /* Property signature from the 
introspection data. */
-const char *property_sig; /* The signature of the new value in the 
received .Set message. */
+char *property_sig; /* The signature of the new value in the received .Set 
message. */
 DBusMessageIter variant_iter; /* Iterator pointing to the beginning of the 
new value variant of a .Set call. */
 
 const char *method; /* Method name (extracted from the message). */
@@ -431,7 +431,7 @@ static enum find_result_t 
find_handler_from_properties_call(struct call_info *ca
 
 dbus_message_iter_recurse(&msg_iter, &call_info->variant_iter);
 
-call_info->property_sig = 
dbus_message_iter_get_signature(&call_info->variant_iter);
+pa_assert_se(call_info->property_sig = 
dbus_message_iter_get_signature(&call_info->variant_iter));
 
 if (*call_info->property_interface) {
 if (!(call_info->iface_entry = 
pa_hashmap_get(call_info->obj_entry->interfaces, 
call_info->property_interface)))
@@ -494,6 +494,7 @@ static enum find_result_t find_handler(struct call_info 
*call_info) {
 static DBusHandlerResult handle_message_cb(DBusConnection *connection, 
DBusMessage *message, void *user_data) {
 pa_dbus_protocol *p = user_data;
 struct call_info call_info;
+call_info.property_sig = NULL;
 
 pa_assert(connection);
 pa_assert(message);
@@ -588,6 +589,9 @@ static DBusHandlerResult handle_message_cb(DBusConnection 
*connection, DBusMessa
 }
 
 finish:
+if (call_info.property_sig)
+dbus_free(call_info.property_sig);
+
 return DBUS_HANDLER_RESULT_HANDLED;
 }
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2018-03-23 Thread Tanu Kaskinen
 src/modules/bluetooth/backend-ofono.c |  112 ++
 1 file changed, 87 insertions(+), 25 deletions(-)

New commits:
commit b2a86cab09e608d2566b498ee7b5d43b6a39a5d7
Author: Luiz Augusto von Dentz 
Date:   Thu Mar 22 14:56:00 2018 +0200

bluetooth: ofono: Use Acquire method if available

Attempt to use Acquire method if available since it directly returns
the fd in the reply or an error if that the connection could not be
created while Connect offer neither of these and depend on
NewConnection to deliver the fd.

diff --git a/src/modules/bluetooth/backend-ofono.c 
b/src/modules/bluetooth/backend-ofono.c
index 2c51497f..5f427043 100644
--- a/src/modules/bluetooth/backend-ofono.c
+++ b/src/modules/bluetooth/backend-ofono.c
@@ -67,7 +67,7 @@ struct hf_audio_card {
 
 bool connecting;
 int fd;
-uint8_t codec;
+int (*acquire)(struct hf_audio_card *card);
 
 pa_bluetooth_transport *transport;
 };
@@ -99,12 +99,95 @@ static pa_dbus_pending* 
hf_dbus_send_and_add_to_pending(pa_bluetooth_backend *ba
 return p;
 }
 
+static DBusMessage *card_send(struct hf_audio_card *card, const char *method, 
DBusError *err)
+{
+pa_bluetooth_transport *t = card->transport;
+DBusMessage *m, *r;
+
+pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, 
"org.ofono.HandsfreeAudioCard", method));
+r = 
dbus_connection_send_with_reply_and_block(pa_dbus_connection_get(card->backend->connection),
 m, -1, err);
+dbus_message_unref(m);
+
+return r;
+}
+
+static int card_connect(struct hf_audio_card *card) {
+DBusMessage *r;
+DBusError err;
+
+if (card->connecting)
+return -EAGAIN;
+
+card->connecting = true;
+
+dbus_error_init(&err);
+r = card_send(card, "Connect", &err);
+
+if (!r) {
+pa_log_error("Failed to connect %s: %s", err.name, err.message);
+card->connecting = false;
+dbus_error_free(&err);
+return -1;
+}
+
+dbus_message_unref(r);
+
+if (card->connecting)
+return -EAGAIN;
+
+return 0;
+}
+
+static int card_acquire(struct hf_audio_card *card) {
+int fd;
+uint8_t codec;
+DBusMessage *r;
+DBusError err;
+
+/* Try acquiring the stream first which was introduced in 1.21 */
+dbus_error_init(&err);
+r = card_send(card, "Acquire", &err);
+
+if (!r) {
+if (!pa_streq(err.name, DBUS_ERROR_UNKNOWN_METHOD)) {
+pa_log_error("Failed to acquire %s: %s", err.name, err.message);
+dbus_error_free(&err);
+return -1;
+}
+dbus_error_free(&err);
+/* Fallback to Connect as this might be an old version of ofono */
+card->acquire = card_connect;
+return card_connect(card);
+}
+
+if ((dbus_message_get_args(r, NULL, DBUS_TYPE_UNIX_FD, &fd,
+  DBUS_TYPE_BYTE, &codec,
+  DBUS_TYPE_INVALID) == true)) {
+dbus_message_unref(r);
+if (codec != HFP_AUDIO_CODEC_CVSD) {
+pa_log_error("Invalid codec: %u", codec);
+/* shutdown to make sure connection is dropped immediately */
+shutdown(fd, SHUT_RDWR);
+close(fd);
+return -1;
+}
+card->transport->codec = codec;
+card->fd = fd;
+return 0;
+}
+
+pa_log_error("Unable to acquire");
+dbus_message_unref(r);
+return -1;
+}
+
 static struct hf_audio_card *hf_audio_card_new(pa_bluetooth_backend *backend, 
const char *path) {
 struct hf_audio_card *card = pa_xnew0(struct hf_audio_card, 1);
 
 card->path = pa_xstrdup(path);
 card->backend = backend;
 card->fd = -1;
+card->acquire = card_acquire;
 
 return card;
 }
@@ -157,28 +240,9 @@ static int 
hf_audio_agent_transport_acquire(pa_bluetooth_transport *t, bool opti
 pa_assert(card);
 
 if (!optional && card->fd < 0) {
-DBusMessage *m, *r;
-DBusError derr;
-
-if (card->connecting)
-return -EAGAIN;
-
-card->connecting = true;
-
-dbus_error_init(&derr);
-pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, 
"org.ofono.HandsfreeAudioCard", "Connect"));
-r = 
dbus_connection_send_with_reply_and_block(pa_dbus_connection_get(card->backend->connection),
 m, -1, &derr);
-dbus_message_unref(m);
-m = NULL;
-
-if (!r)
-return -1;
-
-dbus_message_unref(r);
-r = NULL;
-
-if (card->connecting)
-return -EAGAIN;
+err = card->acquire(card);
+if (err < 0)
+return err;
 }
 
 /* The correct block size should take into account the SCO MTU from
@@ -191,8 +255,6 @@ static int 
hf_audio_agent_transport_acquire(pa_bluetooth_transport *t, bool opti
 if (omtu)
 *omtu = 48;
 
-t->codec = card->codec;
-
 err = socket_accept(card->fd);
 if (err < 0) {
 

[pulseaudio-commits] Branch 'next' - src/modules

2018-03-22 Thread Tanu Kaskinen
 src/modules/alsa/alsa-sink.c |6 +++---
 src/modules/alsa/alsa-source.c   |6 +++---
 src/modules/bluetooth/module-bluez4-device.c |8 
 src/modules/bluetooth/module-bluez5-device.c |8 
 src/modules/echo-cancel/module-echo-cancel.c |2 +-
 src/modules/module-equalizer-sink.c  |2 +-
 src/modules/module-esound-sink.c |4 ++--
 src/modules/module-ladspa-sink.c |2 +-
 src/modules/module-null-sink.c   |2 +-
 src/modules/module-pipe-sink.c   |4 ++--
 src/modules/module-remap-sink.c  |2 +-
 src/modules/module-solaris.c |   16 
 src/modules/module-virtual-sink.c|2 +-
 src/modules/module-virtual-surround-sink.c   |2 +-
 src/modules/oss/module-oss.c |   12 ++--
 src/modules/raop/raop-sink.c |4 ++--
 16 files changed, 41 insertions(+), 41 deletions(-)

New commits:
commit 4de2f58f02a39ea0b45aa722f8dd7450434ff39f
Author: Raman Shyshniou 
Date:   Tue Mar 20 16:26:20 2018 +0300

optimize set_state_in_io_thread() callbacks

Source and sink are passed in arguments to set_state_in_io_thread()
callbacks. There is optimal to access them directly.

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index a1f10057..eb79a444 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1291,7 +1291,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, 
pa_sink_state_t new_state,
 switch (new_state) {
 
 case PA_SINK_SUSPENDED: {
-pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state));
+pa_assert(PA_SINK_IS_OPENED(s->thread_info.state));
 
 suspend(u);
 
@@ -1302,7 +1302,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, 
pa_sink_state_t new_state,
 case PA_SINK_RUNNING: {
 int r;
 
-if (u->sink->thread_info.state == PA_SINK_INIT) {
+if (s->thread_info.state == PA_SINK_INIT) {
 if (build_pollfd(u) < 0)
 /* FIXME: This will cause an assertion failure, because
  * with the current design pa_sink_put() is not allowed
@@ -1312,7 +1312,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, 
pa_sink_state_t new_state,
 return -PA_ERR_IO;
 }
 
-if (u->sink->thread_info.state == PA_SINK_SUSPENDED) {
+if (s->thread_info.state == PA_SINK_SUSPENDED) {
 if ((r = unsuspend(u)) < 0)
 return r;
 }
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index d2e0a43f..ca85968e 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1146,7 +1146,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, 
pa_source_state_t new_
 switch (new_state) {
 
 case PA_SOURCE_SUSPENDED: {
-pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state));
+pa_assert(PA_SOURCE_IS_OPENED(s->thread_info.state));
 
 suspend(u);
 
@@ -1157,7 +1157,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, 
pa_source_state_t new_
 case PA_SOURCE_RUNNING: {
 int r;
 
-if (u->source->thread_info.state == PA_SOURCE_INIT) {
+if (s->thread_info.state == PA_SOURCE_INIT) {
 if (build_pollfd(u) < 0)
 /* FIXME: This will cause an assertion failure, because
  * with the current design pa_source_put() is not allowed
@@ -1167,7 +1167,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, 
pa_source_state_t new_
 return -PA_ERR_IO;
 }
 
-if (u->source->thread_info.state == PA_SOURCE_SUSPENDED) {
+if (s->thread_info.state == PA_SOURCE_SUSPENDED) {
 if ((r = unsuspend(u)) < 0)
 return r;
 }
diff --git a/src/modules/bluetooth/module-bluez4-device.c 
b/src/modules/bluetooth/module-bluez4-device.c
index 79d75c11..87592834 100644
--- a/src/modules/bluetooth/module-bluez4-device.c
+++ b/src/modules/bluetooth/module-bluez4-device.c
@@ -423,7 +423,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, 
pa_sink_state_t new_state,
 
 case PA_SINK_SUSPENDED:
 /* Ignore if transition is PA_SINK_INIT->PA_SINK_SUSPENDED */
-if (!PA_SINK_IS_OPENED(u->sink->thread_info.state))
+if (!PA_SINK_IS_OPENED(s->thread_info.state))
 break;
 
 /* Stop the device if the source is suspended as well */
@@ -437,7 +437,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, 
pa_sink_state_t new_state,
 
 case PA_SINK_IDLE:
 case PA_SINK_RUNNING:
-if (u->sink->thread_info.state != PA_SINK_SUSPENDED)
+if (s->thread_in

[pulseaudio-commits] Branch 'next' - src/modules

2018-03-07 Thread Tanu Kaskinen
 src/modules/bluetooth/module-bluez4-device.c |   16 
 src/modules/bluetooth/module-bluez5-device.c |   24 ++--
 2 files changed, 14 insertions(+), 26 deletions(-)

New commits:
commit b19ec68ced5f9da983b1dd60d1594de11e72d96e
Author: Tanu Kaskinen 
Date:   Mon Feb 19 16:48:25 2018 +0200

bluetooth: fix resume error handling

When resuming a sink or source, pa_sink/source_process_msg() should be
called only if resuming is successful. pa_sink/source_process_msg()
updates thread_info.state and notifies streams about the new state, but
if resuming fails, there's no state change.

diff --git a/src/modules/bluetooth/module-bluez4-device.c 
b/src/modules/bluetooth/module-bluez4-device.c
index ff178226..c6baee84 100644
--- a/src/modules/bluetooth/module-bluez4-device.c
+++ b/src/modules/bluetooth/module-bluez4-device.c
@@ -380,8 +380,6 @@ static int bt_transport_acquire(struct userdata *u, bool 
optional) {
 /* Run from IO thread */
 static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t 
offset, pa_memchunk *chunk) {
 struct userdata *u = PA_SINK(o)->userdata;
-bool failed = false;
-int r;
 
 pa_assert(u->sink == PA_SINK(o));
 pa_assert(u->transport);
@@ -414,7 +412,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void 
*data, int64_t offse
 /* Resume the device if the source was suspended as well */
 if (!u->source || 
!PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
 if (bt_transport_acquire(u, false) < 0)
-failed = true;
+return -1;
 else
 setup_stream(u);
 }
@@ -450,16 +448,12 @@ static int sink_process_msg(pa_msgobject *o, int code, 
void *data, int64_t offse
 }
 }
 
-r = pa_sink_process_msg(o, code, data, offset, chunk);
-
-return (r < 0 || !failed) ? r : -1;
+return pa_sink_process_msg(o, code, data, offset, chunk);
 }
 
 /* Run from IO thread */
 static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t 
offset, pa_memchunk *chunk) {
 struct userdata *u = PA_SOURCE(o)->userdata;
-bool failed = false;
-int r;
 
 pa_assert(u->source == PA_SOURCE(o));
 pa_assert(u->transport);
@@ -491,7 +485,7 @@ static int source_process_msg(pa_msgobject *o, int code, 
void *data, int64_t off
 /* Resume the device if the sink was suspended as well */
 if (!u->sink || 
!PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
 if (bt_transport_acquire(u, false) < 0)
-failed = true;
+return -1;
 else
 setup_stream(u);
 }
@@ -522,9 +516,7 @@ static int source_process_msg(pa_msgobject *o, int code, 
void *data, int64_t off
 
 }
 
-r = pa_source_process_msg(o, code, data, offset, chunk);
-
-return (r < 0 || !failed) ? r : -1;
+return pa_source_process_msg(o, code, data, offset, chunk);
 }
 
 /* Called from main thread context */
diff --git a/src/modules/bluetooth/module-bluez5-device.c 
b/src/modules/bluetooth/module-bluez5-device.c
index 7970dda7..b83f0eaf 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -885,8 +885,6 @@ static bool setup_transport_and_stream(struct userdata *u) {
 /* Run from IO thread */
 static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t 
offset, pa_memchunk *chunk) {
 struct userdata *u = PA_SOURCE(o)->userdata;
-bool failed = false;
-int r;
 
 pa_assert(u->source == PA_SOURCE(o));
 pa_assert(u->transport);
@@ -917,8 +915,10 @@ static int source_process_msg(pa_msgobject *o, int code, 
void *data, int64_t off
 break;
 
 /* Resume the device if the sink was suspended as well */
-if (!u->sink || 
!PA_SINK_IS_OPENED(u->sink->thread_info.state))
-failed = !setup_transport_and_stream(u);
+if (!u->sink || 
!PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
+if (!setup_transport_and_stream(u))
+return -1;
+}
 
 /* We don't resume the smoother here. Instead we
  * wait until the first packet arrives */
@@ -953,9 +953,7 @@ static int source_process_msg(pa_msgobject *o, int code, 
void *data, int64_t off
 
 }
 
-r = pa_source_process_msg(o, code, data, offset, chunk);
-
-return (r < 0 || !failed) ? r : -1;
+return pa_source_process_msg(o, code, data, offset, chunk);
 }
 
 /* Run from main thread */
@@ -1057,8 +1055,6 @@ static int add_source(struct userdata *u) {
 /* Run from IO thread */
 static int sink_process_msg(pa_

[pulseaudio-commits] Branch 'next' - src/modules

2018-02-12 Thread Tanu Kaskinen
 src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules |1 
 src/modules/alsa/mixer/profile-sets/cmedia-high-speed-true-hdaudio.conf |   66 
++
 2 files changed, 67 insertions(+)

New commits:
commit c54fa099830f8817c395cd34830af36168664efc
Author: Jean-Philippe Guillemin 
Date:   Mon Feb 12 19:14:21 2018 +0200

alsa-mixer: add a profile-set file to fix iec958 input and output on CMEDIA 
USB2.0 High-Speed True HD Audio

The iec958 output uses device 2 and the iec958 input uses device 0. The
USB configuration in alsa doesn't set up the device numbers correctly,
which is why we need custom configuration in PulseAudio. Ideally this
would be fixed in alsa, but trying to get help for that wasn't
successful.

diff --git a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules 
b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
index 264bfdb3..4dacb62b 100644
--- a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
+++ b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
@@ -106,5 +106,6 @@ ATTRS{idVendor}=="045e", ATTRS{idProduct}=="02bb", 
ENV{PULSE_PROFILE_SET}="kinec
 ATTRS{idVendor}=="041e", ATTRS{idProduct}=="322c", 
ENV{PULSE_PROFILE_SET}="sb-omni-surround-5.1.conf"
 ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="4014", 
ENV{PULSE_PROFILE_SET}="dell-dock-tb16-usb-audio.conf"
 ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1260", 
ENV{PULSE_PROFILE_SET}="steelseries-arctis-usb-audio.conf"
+ATTRS{idVendor}=="147a", ATTRS{idProduct}=="e055", 
ENV{PULSE_PROFILE_SET}="cmedia-high-speed-true-hdaudio.conf"
 
 LABEL="pulseaudio_end"
diff --git 
a/src/modules/alsa/mixer/profile-sets/cmedia-high-speed-true-hdaudio.conf 
b/src/modules/alsa/mixer/profile-sets/cmedia-high-speed-true-hdaudio.conf
new file mode 100644
index ..1b6f61c7
--- /dev/null
+++ b/src/modules/alsa/mixer/profile-sets/cmedia-high-speed-true-hdaudio.conf
@@ -0,0 +1,66 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, see .
+
+# Config for CMEDIA USB2.0 High-Speed True HD Audio 147a:e055
+# Added by Jean-Philippe Guillemin 
+
+
+[General]
+auto-profiles = yes
+
+[Mapping analog-stereo]
+device-strings = front:%f
+channel-map = left,right
+paths-output = analog-output analog-output-lineout analog-output-speaker 
analog-output-headphones analog-output-headphones-2
+paths-input = analog-input-front-mic analog-input-rear-mic 
analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic 
analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner 
analog-input-fm analog-input-mic-line analog-input-headphone-mic 
analog-input-headset-mic
+priority = 10
+
+# If everything else fails, try to use hw:0 as a stereo device.
+[Mapping stereo-fallback]
+device-strings = hw:%f
+fallback = yes
+channel-map = front-left,front-right
+paths-output = analog-output analog-output-lineout analog-output-speaker 
analog-output-headphones analog-output-headphones-2
+paths-input = analog-input-front-mic analog-input-rear-mic 
analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic 
analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner 
analog-input-fm analog-input-mic-line analog-input-headphone-mic 
analog-input-headset-mic
+priority = 1
+
+[Mapping analog-surround-21]
+device-strings = surround21:%f
+channel-map = front-left,front-right,lfe
+paths-output = analog-output analog-output-lineout analog-output-speaker
+priority = 8
+direction = output
+
+[Mapping analog-surround-51]
+device-strings = surround51:%f
+channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
+paths-output = analog-output analog-output-lineout analog-output-speaker
+priority = 8
+direction = output
+
+[Mapping analog-surround-71]
+device-strings = surround71:%f
+channel-map = 
front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
+description = Analog Surround 7.1
+paths-output = analog-output analog-output-lineout analog-output-speaker
+priority = 7
+direction = output
+
+[Mapping iec958-stereo]
+device-strings = hw:%f,2 hw:%f,0
+channel-map = left,right
+paths-output = iec958-stereo-output
+paths-input = iec958-stereo-input
+priority = 5

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.fre

[pulseaudio-commits] Branch 'next' - src/modules

2017-09-03 Thread Arun Raghavan
 src/modules/module-always-source.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit df62e01967812fc83034ec613e3ddbcf1ef58e19
Author: Arun Raghavan 
Date:   Sun Sep 3 13:26:14 2017 +0530

always-source: Fix pa_module_load() usage

The API changed slightly since the original patch was written.

diff --git a/src/modules/module-always-source.c 
b/src/modules/module-always-source.c
index 09ac7aa5..5c1f22aa 100644
--- a/src/modules/module-always-source.c
+++ b/src/modules/module-always-source.c
@@ -80,7 +80,7 @@ static void load_null_source_if_needed(pa_core *c, pa_source 
*source, struct use
 u->ignore = true;
 
 t = pa_sprintf_malloc("source_name=%s", u->source_name);
-m = pa_module_load(c, "module-null-source", t);
+pa_module_load(&m, c, "module-null-source", t);
 u->null_module = m ? m->index : PA_INVALID_INDEX;
 pa_xfree(t);
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2017-09-02 Thread Tanu Kaskinen
 src/modules/bluetooth/backend-native.c   |2 +-
 src/modules/bluetooth/bluez5-util.c  |1 +
 src/modules/bluetooth/bluez5-util.h  |   11 +++
 src/modules/bluetooth/module-bluez5-device.c |2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit a5bed121185dc46ddcd346a3a7aaab2b3b0f2931
Author: Tanu Kaskinen 
Date:   Sat Sep 2 15:44:58 2017 +0300

bluetooth: recognize another HSP HS UUID

There are actually two HSP HS UUIDs. My theory is that the second one
was added, because someone was not happy with the old UUID being used
for identifying two different things (the HSP profile as a whole, and
the HS role within the HSP profile). Some headsets only use the new
UUID, and those headsets won't work if we don't recognize the new UUID.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93898

diff --git a/src/modules/bluetooth/backend-native.c 
b/src/modules/bluetooth/backend-native.c
index 6eb4e168..1ed436f2 100644
--- a/src/modules/bluetooth/backend-native.c
+++ b/src/modules/bluetooth/backend-native.c
@@ -335,7 +335,7 @@ static void register_profile(pa_bluetooth_backend *b, const 
char *profile, const
 pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &uuid));
 dbus_message_iter_open_container(&i, DBUS_TYPE_ARRAY, 
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING
 DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, 
&d);
-if (pa_streq (uuid, PA_BLUETOOTH_UUID_HSP_HS)) {
+if (pa_bluetooth_uuid_is_hsp_hs(uuid)) {
 /* In the headset role, the connection will only be initiated from the 
remote side */
 autoconnect = 0;
 pa_dbus_append_basic_variant_dict_entry(&d, "AutoConnect", 
DBUS_TYPE_BOOLEAN, &autoconnect);
diff --git a/src/modules/bluetooth/bluez5-util.c 
b/src/modules/bluetooth/bluez5-util.c
index 23100fca..04383786 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -176,6 +176,7 @@ static bool device_supports_profile(pa_bluetooth_device 
*device, pa_bluetooth_pr
 return !!pa_hashmap_get(device->uuids, 
PA_BLUETOOTH_UUID_A2DP_SOURCE);
 case PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT:
 return !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_HS)
+|| !!pa_hashmap_get(device->uuids, 
PA_BLUETOOTH_UUID_HSP_HS_ALT)
 || !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_HF);
 case PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY:
 return !!pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HSP_AG)
diff --git a/src/modules/bluetooth/bluez5-util.h 
b/src/modules/bluetooth/bluez5-util.h
index a3e7bf3d..ad30708f 100644
--- a/src/modules/bluetooth/bluez5-util.h
+++ b/src/modules/bluetooth/bluez5-util.h
@@ -24,7 +24,14 @@
 
 #define PA_BLUETOOTH_UUID_A2DP_SOURCE "110a--1000-8000-00805f9b34fb"
 #define PA_BLUETOOTH_UUID_A2DP_SINK   "110b--1000-8000-00805f9b34fb"
+
+/* There are two HSP HS UUIDs. The first one (older?) is used both as the HSP
+ * profile identifier and as the HS role identifier, while the second one is
+ * only used to identify the role. As far as PulseAudio is concerned, the two
+ * UUIDs mean exactly the same thing. */
 #define PA_BLUETOOTH_UUID_HSP_HS  "1108--1000-8000-00805f9b34fb"
+#define PA_BLUETOOTH_UUID_HSP_HS_ALT  "1131--1000-8000-00805f9b34fb"
+
 #define PA_BLUETOOTH_UUID_HSP_AG  "1112--1000-8000-00805f9b34fb"
 #define PA_BLUETOOTH_UUID_HFP_HF  "111e--1000-8000-00805f9b34fb"
 #define PA_BLUETOOTH_UUID_HFP_AG  "111f--1000-8000-00805f9b34fb"
@@ -157,6 +164,10 @@ pa_hook* 
pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hoo
 
 const char *pa_bluetooth_profile_to_string(pa_bluetooth_profile_t profile);
 
+static inline bool pa_bluetooth_uuid_is_hsp_hs(const char *uuid) {
+return pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS) || pa_streq(uuid, 
PA_BLUETOOTH_UUID_HSP_HS_ALT);
+}
+
 #define HEADSET_BACKEND_OFONO 0
 #define HEADSET_BACKEND_NATIVE 1
 #define HEADSET_BACKEND_AUTO 2
diff --git a/src/modules/bluetooth/module-bluez5-device.c 
b/src/modules/bluetooth/module-bluez5-device.c
index 617aac90..9c9c3443 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -1893,7 +1893,7 @@ static int uuid_to_profile(const char *uuid, 
pa_bluetooth_profile_t *_r) {
 *_r = PA_BLUETOOTH_PROFILE_A2DP_SINK;
 else if (pa_streq(uuid, PA_BLUETOOTH_UUID_A2DP_SOURCE))
 *_r = PA_BLUETOOTH_PROFILE_A2DP_SOURCE;
-else if (pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS) || pa_streq(uuid, 
PA_BLUETOOTH_UUID_HFP_HF))
+else if (pa_bluetooth_uuid_is_hsp_hs(uuid) || pa_streq(uuid, 
PA_BLUETOOTH_UUID_HFP_HF))
 *_r = PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT;
 else if (pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_AG) || pa_streq(uuid, 
PA_BLUETOOTH_UUID_HF

[pulseaudio-commits] Branch 'next' - src/modules

2017-09-02 Thread Tanu Kaskinen
 src/modules/alsa/alsa-mixer.c |1 
 src/modules/alsa/mixer/paths/steelseries-arctis-input.conf|   25 
+
 src/modules/alsa/mixer/paths/steelseries-arctis-output-mono.conf  |   29 
++
 src/modules/alsa/mixer/paths/steelseries-arctis-output-stereo.conf|   27 
++
 src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules   |1 
 src/modules/alsa/mixer/profile-sets/steelseries-arctis-usb-audio.conf |   43 
++
 6 files changed, 126 insertions(+)

New commits:
commit 814419cc3d788acb9113a3d62c373deb1a911e75
Author: Johan Heikkilä 
Date:   Sun Aug 27 16:29:37 2017 +0300

alsa-mixer: add support for Steelseries Arctis 7 headset

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index a7ad39dc..9c3fe0be 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -2469,6 +2469,7 @@ static int path_verify(pa_alsa_path *p) {
 { "analog-input-video", N_("Video") },
 { "analog-output",  N_("Analog Output") },
 { "analog-output-headphones",   N_("Headphones") },
+{ "analog-output-headphones-mono",N_("Headphones Mono Output") },
 { "analog-output-lfe-on-mono",  N_("LFE on Separate Mono Output") },
 { "analog-output-lineout",  N_("Line Out") },
 { "analog-output-mono", N_("Analog Mono Output") },
diff --git a/src/modules/alsa/mixer/paths/steelseries-arctis-input.conf 
b/src/modules/alsa/mixer/paths/steelseries-arctis-input.conf
new file mode 100644
index ..f3115ba6
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/steelseries-arctis-input.conf
@@ -0,0 +1,25 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, see .
+
+; Steelseries Arctis 7 USB headset microphone path.
+
+[General]
+description-key = analog-input-microphone-headset
+
+[Element Headset]
+volume = merge
+switch = mute
+override-map.1 = all
+override-map.2 = all-left,all-right
diff --git a/src/modules/alsa/mixer/paths/steelseries-arctis-output-mono.conf 
b/src/modules/alsa/mixer/paths/steelseries-arctis-output-mono.conf
new file mode 100644
index ..67950618
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/steelseries-arctis-output-mono.conf
@@ -0,0 +1,29 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, see .
+
+; Steelseries Arctis 7 USB headset mono output path. The headset has two
+; output devices. The first one is mono, meant for voice audio, and the
+; second one is stereo, meant for everything else. The purpose of this
+; unusual design is to provide separate volume controls for voice and
+; other audio, which can be useful in gaming.
+
+[General]
+description-key = analog-output-headphones-mono
+
+[Element PCM]
+volume = merge
+switch = mute
+override-map.1 = all
+override-map.2 = all-left,all-right
diff --git a/src/modules/alsa/mixer/paths/steelseries-arctis-output-stereo.conf 
b/src/modules/alsa/mixer/paths/steelseries-arctis-output-stereo.conf
new file mode 100644
index ..4e10c800
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/steelseries-arctis-output-stereo.conf
@@ -0,0 +1,27 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have 

[pulseaudio-commits] Branch 'next' - src/modules

2017-08-30 Thread Tanu Kaskinen
 src/modules/alsa/alsa-mixer.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e84dc8b8989c81dfcdb71926f8abf4c38aa1a9b7
Author: Ian Ray 
Date:   Wed Aug 30 11:09:48 2017 +0300

alsa-mixer: round, not truncate, in to_alsa_dB

to_alsa_dB() returns a result rounded to two decimal places (instead of
using integer truncation) to avoid small errors when converting between
dB and volume.

Consider playback at -22 dB (which is supported by ALSA) but results in
the higher level of -21 dB plus software attenuation.

pa_sw_volume_from_dB(-22) = 28172
pa_sw_volume_to_dB(28172) = -21.9997351
to_alsa_dB(-21.9997351)   = -2199

ALSA value 106 = -2200
ALSA value 107 = -2100
...

rounding = +1  /* "accurate or first above" */
snd_mixer_selem_ask_playback_dB_vol(me, -2199, rounding, &alsa_val)
alsa_val = -2100

Signed-off-by: Ian Ray 

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 3dbf6b1d..a7ad39dc 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -700,7 +700,7 @@ void pa_alsa_path_set_free(pa_alsa_path_set *ps) {
 }
 
 static long to_alsa_dB(pa_volume_t v) {
-return (long) (pa_sw_volume_to_dB(v) * 100.0);
+return lround(pa_sw_volume_to_dB(v) * 100.0);
 }
 
 static pa_volume_t from_alsa_dB(long v) {

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2017-08-16 Thread Tanu Kaskinen
 src/modules/module-tunnel-sink-new.c   |   15 +++
 src/modules/module-tunnel-source-new.c |   12 
 2 files changed, 27 insertions(+)

New commits:
commit 0fe98ecf5a99e03a300b98e3f71401364ebb115e
Author: Georg Chini 
Date:   Sat Aug 12 22:29:26 2017 +0200

tunnel-{sink, source}-new: Fix assertion when used with loopback or 
combine-sink

Currently pulseaudio crashes with an assertion in 
pa_rtpoll_item_new_asyncmsgq_read()
or pa_rtpoll_item_new_asyncmsgq_write() if a loopback is applied to a 
tunnel-new
sink or source, because tunnel-{sink,source}-new do not set 
thread_info.rtpoll.
The same applies to module-combine-sink and module-rtp-recv.

This patch is not a complete fix for the problem but provides a temporary 
band-aid
by initializing thread_info.rtpoll properly. The rtpoll created is never 
run, but
loopback and combine-sink nevertheless work, see comments in the code.

This patch does not work for module-rtp-recv, but using rtp-recv with a 
remote
sink does not seem to make a lot of sense anyway.

Bug link: https://bugs.freedesktop.org/show_bug.cgi?id=73429

diff --git a/src/modules/module-tunnel-sink-new.c 
b/src/modules/module-tunnel-sink-new.c
index dd6c8866..7962a5af 100644
--- a/src/modules/module-tunnel-sink-new.c
+++ b/src/modules/module-tunnel-sink-new.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "module-tunnel-sink-new-symdef.h"
@@ -77,6 +78,7 @@ struct userdata {
 
 pa_context *context;
 pa_stream *stream;
+pa_rtpoll *rtpoll;
 
 bool update_stream_bufferattr_after_connect;
 
@@ -503,6 +505,15 @@ int pa__init(pa_module *m) {
 goto fail;
 }
 
+/* The rtpoll created here is never run. It is only necessary to avoid 
crashes
+ * when module-tunnel-sink-new is used together with module-loopback or
+ * module-combine-sink. Both modules base their asyncmsq on the rtpoll 
provided
+ * by the sink. module-loopback and combine-sink only work because they 
call
+ * pa_asyncmsq_process_one() themselves. module_rtp_recv also uses the 
rtpoll,
+ * but never calls pa_asyncmsq_process_one(), so it will not work in 
combination
+ * with module-tunnel-sink-new. */
+u->rtpoll = pa_rtpoll_new();
+
 /* Create sink */
 pa_sink_new_data_init(&sink_data);
 sink_data.driver = __FILE__;
@@ -541,6 +552,7 @@ int pa__init(pa_module *m) {
 
 /* set thread message queue */
 pa_sink_set_asyncmsgq(u->sink, u->thread_mq->inq);
+pa_sink_set_rtpoll(u->sink, u->rtpoll);
 
 if (!(u->thread = pa_thread_new("tunnel-sink", thread_func, u))) {
 pa_log("Failed to create thread.");
@@ -601,5 +613,8 @@ void pa__done(pa_module *m) {
 if (u->sink)
 pa_sink_unref(u->sink);
 
+if (u->rtpoll)
+pa_rtpoll_free(u->rtpoll);
+
 pa_xfree(u);
 }
diff --git a/src/modules/module-tunnel-source-new.c 
b/src/modules/module-tunnel-source-new.c
index 2db928c8..f547911b 100644
--- a/src/modules/module-tunnel-source-new.c
+++ b/src/modules/module-tunnel-source-new.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "module-tunnel-source-new-symdef.h"
@@ -75,6 +76,7 @@ struct userdata {
 
 pa_context *context;
 pa_stream *stream;
+pa_rtpoll *rtpoll;
 
 bool update_stream_bufferattr_after_connect;
 bool connected;
@@ -502,6 +504,12 @@ int pa__init(pa_module *m) {
 goto fail;
 }
 
+/* The rtpoll created here is never run. It is only necessary to avoid 
crashes
+ * when module-tunnel-source-new is used together with module-loopback.
+ * module-loopback bases the asyncmsq on the rtpoll provided by the source 
and
+ * only works because it calls pa_asyncmsq_process_one(). */
+u->rtpoll = pa_rtpoll_new();
+
 /* Create source */
 pa_source_new_data_init(&source_data);
 source_data.driver = __FILE__;
@@ -538,6 +546,7 @@ int pa__init(pa_module *m) {
 u->source->update_requested_latency = source_update_requested_latency_cb;
 
 pa_source_set_asyncmsgq(u->source, u->thread_mq->inq);
+pa_source_set_rtpoll(u->source, u->rtpoll);
 
 if (!(u->thread = pa_thread_new("tunnel-source", thread_func, u))) {
 pa_log("Failed to create thread.");
@@ -598,5 +607,8 @@ void pa__done(pa_module *m) {
 if (u->source)
 pa_source_unref(u->source);
 
+if (u->rtpoll)
+pa_rtpoll_free(u->rtpoll);
+
 pa_xfree(u);
 }

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2017-08-04 Thread Tanu Kaskinen
 src/modules/alsa/mixer/paths/iec958-stereo-input.conf |   20 ++
 1 file changed, 20 insertions(+)

New commits:
commit 87a8908d73a36dc1fce7cc9ff0a46e7d4e7e2ef1
Author: Tanu Kaskinen 
Date:   Fri Aug 4 11:14:43 2017 +0300

alsa-mixer: set PCM Capture Source for iec958 input

It was reported that on a certain USB card, identified as
"0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound Device",
the "PCM Capture Source" element had to be set to "IEC958 In" before
the iec958 input would work.

The iec958-stereo-input.conf file didn't exist before, although the path
was referenced in the default.conf profile configuration file.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=101973

diff --git a/src/modules/alsa/mixer/paths/iec958-stereo-input.conf 
b/src/modules/alsa/mixer/paths/iec958-stereo-input.conf
new file mode 100644
index ..babc8398
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/iec958-stereo-input.conf
@@ -0,0 +1,20 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, see .
+
+[Element PCM Capture Source]
+enumeration = select
+
+[Option PCM Capture Source:IEC958 In]
+name = iec958-input

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2017-07-30 Thread Tanu Kaskinen
 src/modules/raop/raop-sink.c |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 58fb7b734d17589bef33b41a5453c8be4dc87169
Author: Tanu Kaskinen 
Date:   Fri Jul 28 04:07:49 2017 +0300

raop: silence a Coverity complaint

CID: 1398155

diff --git a/src/modules/raop/raop-sink.c b/src/modules/raop/raop-sink.c
index e5d219e8..4d13927f 100644
--- a/src/modules/raop/raop-sink.c
+++ b/src/modules/raop/raop-sink.c
@@ -391,6 +391,13 @@ static void thread_func(void *userdata) {
 if (!pa_raop_client_can_stream(u->raop))
 continue;
 
+/* This assertion is meant to silence a complaint from Coverity about
+ * pollfd being possibly NULL when we access it later. That's a false
+ * positive, because we check pa_raop_client_can_stream() above, and if
+ * that returns true, it means that the connection is up, and when the
+ * connection is up, pollfd will be non-NULL. */
+pa_assert(pollfd);
+
 if (u->memchunk.length <= 0) {
 if (u->memchunk.memblock)
 pa_memblock_unref(u->memchunk.memblock);

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2017-07-27 Thread Tanu Kaskinen
 src/modules/bluetooth/module-bluez5-device.c |   20 
 1 file changed, 20 insertions(+)

New commits:
commit 47d128587846c2dd4d33d56fc031e367b610ce4e
Author: Georg Chini 
Date:   Sat Jul 22 10:47:07 2017 +0200

bluez5-device: Set transport state correctly for AG role

When connecting a headset via the native backend, the transport state was
not updated correctly.

This patch sets the state to PLAYING in transport_acquire() if necessary.

diff --git a/src/modules/bluetooth/module-bluez5-device.c 
b/src/modules/bluetooth/module-bluez5-device.c
index ccab10ac..617aac90 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -77,6 +77,7 @@ static const char* const valid_modargs[] = {
 enum {
 BLUETOOTH_MESSAGE_IO_THREAD_FAILED,
 BLUETOOTH_MESSAGE_STREAM_FD_HUP,
+BLUETOOTH_MESSAGE_SET_TRANSPORT_PLAYING,
 BLUETOOTH_MESSAGE_MAX
 };
 
@@ -745,9 +746,18 @@ static int transport_acquire(struct userdata *u, bool 
optional) {
 if (u->stream_fd < 0)
 return -1;
 
+/* transport_acquired must be set before calling
+ * pa_bluetooth_transport_set_state() */
 u->transport_acquired = true;
 pa_log_info("Transport %s acquired: fd %d", u->transport->path, 
u->stream_fd);
 
+if (u->transport->state == PA_BLUETOOTH_TRANSPORT_STATE_IDLE) {
+if (pa_thread_mq_get() != NULL)
+pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(u->msg), 
BLUETOOTH_MESSAGE_SET_TRANSPORT_PLAYING, NULL, 0, NULL, NULL);
+else
+pa_bluetooth_transport_set_state(u->transport, 
PA_BLUETOOTH_TRANSPORT_STATE_PLAYING);
+}
+
 return 0;
 }
 
@@ -2138,6 +2148,16 @@ static int device_process_msg(pa_msgobject *obj, int 
code, void *data, int64_t o
 if (u->transport->state > PA_BLUETOOTH_TRANSPORT_STATE_IDLE)
 pa_bluetooth_transport_set_state(u->transport, 
PA_BLUETOOTH_TRANSPORT_STATE_IDLE);
 break;
+case BLUETOOTH_MESSAGE_SET_TRANSPORT_PLAYING:
+/* transport_acquired needs to be checked here, because a message 
could have been
+ * pending when the profile was switched. If the new transport has 
been acquired
+ * correctly, the call below will have no effect because the 
transport state is
+ * already PLAYING. If transport_acquire() failed for the new 
profile, the transport
+ * state should not be changed. If the transport has been released 
for other reasons
+ * (I/O thread shutdown), transport_acquired will also be false. */
+if (u->transport_acquired)
+pa_bluetooth_transport_set_state(u->transport, 
PA_BLUETOOTH_TRANSPORT_STATE_PLAYING);
+break;
 }
 
 return 0;

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2017-07-10 Thread Tanu Kaskinen
 src/modules/bluetooth/module-bluez5-device.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 44b8f8555fc2104a5798d261a59e1e05f5840e31
Author: Grzegorz Kolodziejczyk 
Date:   Mon Jun 12 17:42:26 2017 +0200

bluez5-device: Log subband count instead of subband flag

As log information says, SBC log info have to have one of two subband count
values: 4 or 8, instead of subband flag.

diff --git a/src/modules/bluetooth/module-bluez5-device.c 
b/src/modules/bluetooth/module-bluez5-device.c
index a96da17d..ccab10ac 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -1269,7 +1269,7 @@ static void transport_config(struct userdata *u) {
 sbc_info->frame_length = sbc_get_frame_length(&sbc_info->sbc);
 
 pa_log_info("SBC parameters: allocation=%u, subbands=%u, blocks=%u, 
bitpool=%u",
-sbc_info->sbc.allocation, sbc_info->sbc.subbands, 
sbc_info->sbc.blocks, sbc_info->sbc.bitpool);
+sbc_info->sbc.allocation, sbc_info->sbc.subbands ? 8 : 4, 
sbc_info->sbc.blocks, sbc_info->sbc.bitpool);
 }
 }
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2017-07-06 Thread Tanu Kaskinen
 src/modules/module-loopback.c |   49 ++
 1 file changed, 31 insertions(+), 18 deletions(-)

New commits:
commit 4155ae89f0e5df72c27470a521389cb9fb7ecf5f
Author: Georg Chini 
Date:   Mon Apr 17 21:37:43 2017 +0200

loopback: Use new allow_negative flag of pa_{source, 
sink}_get_latency_within_thread()

Setting the allow_negative flag of 
pa_{source,sink}_get_latency_within_thread() to true
leads to improved end to end latency estimation and to correct handling of 
negative port
latency offsets.

diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index ded59e1a..ab38c292 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -110,12 +110,12 @@ struct userdata {
 /* Used for sink input and source output snapshots */
 struct {
 int64_t send_counter;
-pa_usec_t source_latency;
+int64_t source_latency;
 pa_usec_t source_timestamp;
 
 int64_t recv_counter;
 size_t loopback_memblockq_length;
-pa_usec_t sink_latency;
+int64_t sink_latency;
 pa_usec_t sink_timestamp;
 } latency_snapshot;
 
@@ -125,9 +125,9 @@ struct userdata {
 /* Output thread variables */
 struct {
 int64_t recv_counter;
+pa_usec_t effective_source_latency;
 
 /* Copied from main thread */
-pa_usec_t effective_source_latency;
 pa_usec_t minimum_latency;
 
 /* Various booleans */
@@ -305,7 +305,8 @@ static void adjust_rates(struct userdata *u) {
 size_t buffer;
 uint32_t old_rate, base_rate, new_rate, run_hours;
 int32_t latency_difference;
-pa_usec_t current_buffer_latency, snapshot_delay, 
current_source_sink_latency, current_latency, latency_at_optimum_rate;
+pa_usec_t current_buffer_latency, snapshot_delay;
+int64_t current_source_sink_latency, current_latency, 
latency_at_optimum_rate;
 pa_usec_t final_latency;
 
 pa_assert(u);
@@ -352,7 +353,7 @@ static void adjust_rates(struct userdata *u) {
 latency_at_optimum_rate = current_source_sink_latency + 
current_buffer_latency * old_rate / base_rate;
 
 final_latency = PA_MAX(u->latency, u->minimum_latency);
-latency_difference = (int32_t)((int64_t)latency_at_optimum_rate - 
final_latency);
+latency_difference = (int32_t)(latency_at_optimum_rate - final_latency);
 
 pa_log_debug("Loopback overall latency is %0.2f ms + %0.2f ms + %0.2f ms = 
%0.2f ms",
 (double) u->latency_snapshot.sink_latency / PA_USEC_PER_MSEC,
@@ -466,12 +467,23 @@ static void update_latency_boundaries(struct userdata *u, 
pa_source *source, pa_
 
 /* Called from output context
  * Sets the memblockq to the configured latency corrected by 
latency_offset_usec */
-static void memblockq_adjust(struct userdata *u, pa_usec_t 
latency_offset_usec, bool allow_push) {
+static void memblockq_adjust(struct userdata *u, int64_t latency_offset_usec, 
bool allow_push) {
 size_t current_memblockq_length, requested_memblockq_length, 
buffer_correction;
-pa_usec_t requested_buffer_latency, final_latency;
+int64_t requested_buffer_latency;
+pa_usec_t final_latency, requested_sink_latency;
 
 final_latency = PA_MAX(u->latency, u->output_thread_info.minimum_latency);
-requested_buffer_latency = PA_CLIP_SUB(final_latency, latency_offset_usec);
+
+/* If source or sink have some large negative latency offset, we might 
want to
+ * hold more than final_latency in the memblockq */
+requested_buffer_latency = (int64_t)final_latency - latency_offset_usec;
+
+/* Keep at least one sink latency in the queue to make sure that the sink
+ * never underruns initially */
+requested_sink_latency = 
pa_sink_get_requested_latency_within_thread(u->sink_input->sink);
+if (requested_buffer_latency < (int64_t)requested_sink_latency)
+requested_buffer_latency = requested_sink_latency;
+
 requested_memblockq_length = pa_usec_to_bytes(requested_buffer_latency, 
&u->sink_input->sample_spec);
 current_memblockq_length = pa_memblockq_get_length(u->memblockq);
 
@@ -492,7 +504,8 @@ static void memblockq_adjust(struct userdata *u, pa_usec_t 
latency_offset_usec,
 /* Called from input thread context */
 static void source_output_push_cb(pa_source_output *o, const pa_memchunk 
*chunk) {
 struct userdata *u;
-pa_usec_t push_time, current_source_latency;
+pa_usec_t push_time;
+int64_t current_source_latency;
 
 pa_source_output_assert_ref(o);
 pa_source_output_assert_io_context(o);
@@ -500,9 +513,9 @@ static void source_output_push_cb(pa_source_output *o, 
const pa_memchunk *chunk)
 
 /* Send current source latency and timestamp with the message */
 push_time = pa_rtclock_now();
-current_source_latency = 
pa_source_get_latency_within_thread(u->source_output->source, false);
+current_source_latency = 
pa_source_get_latency_within_thread(u->source_output->sourc

[pulseaudio-commits] Branch 'next' - src/modules

2017-06-27 Thread Tanu Kaskinen
 src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules   |1 
 src/modules/alsa/mixer/profile-sets/dell-dock-tb16-usb-audio.conf |   55 
++
 2 files changed, 56 insertions(+)

New commits:
commit c8851db8b223019415ddde15262722160f53f0c4
Author: Hui Wang 
Date:   Fri May 26 15:42:40 2017 +0800

alsa-mixer: Add support for usb audio in the Dell dock TB16

There are one headset jack on the front panel of TB16, through this
jack, we have one stereo headphone output (hw:%f,0,0) and one mono
headset-mic input (hw:%f,0,0); and there is one speaker output jack
(hw:%f,1,0) on the rear panel of TB16.

The detail information of the Dell dock TB16:
http://www.dell.com/support/article/sg/en/sgbsdt1/SLN301105

Signed-off-by: Hui Wang 

diff --git a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules 
b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
index 70e34e6f..805a05b2 100644
--- a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
+++ b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
@@ -98,5 +98,6 @@ ATTRS{idVendor}=="17cc", ATTRS{idProduct}=="1021", 
ENV{PULSE_PROFILE_SET}="nativ
 ATTRS{idVendor}=="0763", ATTRS{idProduct}=="2012", 
ENV{PULSE_PROFILE_SET}="maudio-fasttrack-pro.conf"
 ATTRS{idVendor}=="045e", ATTRS{idProduct}=="02bb", 
ENV{PULSE_PROFILE_SET}="kinect-audio.conf"
 ATTRS{idVendor}=="041e", ATTRS{idProduct}=="322c", 
ENV{PULSE_PROFILE_SET}="sb-omni-surround-5.1.conf"
+ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="4014", 
ENV{PULSE_PROFILE_SET}="dell-dock-tb16-usb-audio.conf"
 
 LABEL="pulseaudio_end"
diff --git a/src/modules/alsa/mixer/profile-sets/dell-dock-tb16-usb-audio.conf 
b/src/modules/alsa/mixer/profile-sets/dell-dock-tb16-usb-audio.conf
new file mode 100644
index ..11865524
--- /dev/null
+++ b/src/modules/alsa/mixer/profile-sets/dell-dock-tb16-usb-audio.conf
@@ -0,0 +1,55 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, see .
+
+; Dell Dock TB16 USB audio
+;
+; This card has two stereo pairs of output, One Mono input.
+;
+; See default.conf for an explanation on the directives used here.
+
+[General]
+auto-profiles = no
+
+[Mapping analog-stereo-headphone]
+description = Headphone
+device-strings = hw:%f,0,0
+channel-map = left,right
+direction = output
+
+[Mapping analog-stereo-speaker]
+description = Speaker
+device-strings = hw:%f,1,0
+channel-map = left,right
+direction = output
+
+[Mapping analog-stereo-mic]
+description = Headset-Mic
+device-strings = hw:%f,0,0
+channel-map = left,right
+direction = input
+
+
+[Profile output:analog-stereo-speaker]
+description = Speaker
+output-mappings = analog-stereo-speaker
+priority = 60
+skip-probe = yes
+
+[Profile output:analog-stereo-headphone+input:analog-stereo-mic]
+description = Headset
+output-mappings = analog-stereo-headphone
+input-mappings = analog-stereo-mic
+priority = 80
+skip-probe = yes

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2017-04-29 Thread Georg Chini
 src/modules/module-filter-apply.c |  130 +++---
 1 file changed, 107 insertions(+), 23 deletions(-)

New commits:
commit b8858ff24d03dcd0828db529d455e3b2d2493b98
Author: KimJeongYeon 
Date:   Sat Apr 29 11:32:23 2017 +0200

filter-apply: Do not re-route stream to master sink/source when manually 
moved to filter

Currently, if a stream is manually moved to a filter sink or source managed 
by
module-filter-apply, the stream will be silently re-routed to the master 
sink
or source, because the filter.apply property is not set on that stream. We 
can
assume, that the users intention however was to have the stream filtered.

Therefore this patch changes the logic, so that the stream will not be moved
to the master but remains on the filter sink or source. To handle the change
of a property correctly, the filter.apply property must be set temporarily.
An additional property filter.apply.set_by_mfa was introduced to mark those
streams, so that filter.apply can be removed again when the stream moves 
away
from the filter.

diff --git a/src/modules/module-filter-apply.c 
b/src/modules/module-filter-apply.c
index e91fb37d..6ca062ba 100644
--- a/src/modules/module-filter-apply.c
+++ b/src/modules/module-filter-apply.c
@@ -39,6 +39,7 @@
 
 #define PA_PROP_FILTER_APPLY_PARAMETERS PA_PROP_FILTER_APPLY".%s.parameters"
 #define PA_PROP_FILTER_APPLY_MOVING "filter.apply.moving"
+#define PA_PROP_FILTER_APPLY_SET_BY_MFA "filter.apply.set_by_mfa"
 #define PA_PROP_MDM_AUTO_FILTERED   "module-device-manager.auto_filtered"
 
 PA_MODULE_AUTHOR("Colin Guthrie");
@@ -161,6 +162,67 @@ static const char* get_filter_parameters(pa_object *o, 
const char *want, bool is
 return parameters;
 }
 
+/* This function is used to set or unset the filter related stream properties. 
This is necessary
+ * if a stream does not have filter.apply set and is manually moved to a 
filter sink or source.
+ * In this case, the properies must be temporarily set and removed when the 
stream is moved away
+ * from the filter. */
+static void set_filter_properties(pa_proplist *pl, struct filter *filter, bool 
set_properties) {
+char *prop_parameters;
+
+if (set_properties) {
+pa_assert(filter);
+
+pa_proplist_sets(pl, PA_PROP_FILTER_APPLY, filter->name);
+
+if (filter->parameters) {
+prop_parameters = 
pa_sprintf_malloc(PA_PROP_FILTER_APPLY_PARAMETERS, filter->name);
+pa_proplist_sets(pl, prop_parameters, filter->parameters);
+pa_xfree(prop_parameters);
+}
+
+pa_proplist_sets(pl, PA_PROP_FILTER_APPLY_SET_BY_MFA, "1");
+
+} else {
+const char *old_filter_name = NULL;
+
+if (filter)
+old_filter_name = filter->name;
+else
+old_filter_name = pa_proplist_gets(pl, PA_PROP_FILTER_APPLY);
+
+/* If the filter name cannot be determined, properties cannot be 
removed. */
+if (!old_filter_name)
+return;
+
+prop_parameters = pa_sprintf_malloc(PA_PROP_FILTER_APPLY_PARAMETERS, 
old_filter_name);
+pa_proplist_unset(pl, prop_parameters);
+pa_xfree(prop_parameters);
+
+pa_proplist_unset(pl, PA_PROP_FILTER_APPLY);
+pa_proplist_unset(pl, PA_PROP_FILTER_APPLY_SET_BY_MFA);
+}
+}
+
+static struct filter* get_filter_for_object(struct userdata *u, pa_object *o, 
bool is_sink_input) {
+pa_sink *sink = NULL;
+pa_source *source = NULL;
+struct filter *filter = NULL;
+void *state;
+
+if (is_sink_input)
+sink = PA_SINK_INPUT(o)->sink;
+else
+source = PA_SOURCE_OUTPUT(o)->source;
+
+PA_HASHMAP_FOREACH(filter, u->filters, state) {
+if ((is_sink_input && sink == filter->sink) || (!is_sink_input && 
source == filter->source)) {
+return filter;
+}
+}
+
+return NULL;
+}
+
 static bool should_group_filter(struct filter *filter) {
 return pa_streq(filter->name, "echo-cancel");
 }
@@ -309,7 +371,7 @@ static int do_move(struct userdata *u, pa_object *obj, 
pa_object *parent, bool i
 }
 }
 
-static void move_object_for_filter(struct userdata *u, pa_object *o, struct 
filter* filter, bool restore, bool is_sink_input) {
+static void move_object_for_filter(struct userdata *u, pa_object *o, struct 
filter *filter, bool restore, bool is_sink_input) {
 pa_object *parent;
 pa_proplist *pl;
 const char *name;
@@ -343,7 +405,7 @@ static void move_object_for_filter(struct userdata *u, 
pa_object *o, struct filt
 pa_proplist_unset(pl, PA_PROP_FILTER_APPLY_MOVING);
 }
 
-static void move_objects_for_filter(struct userdata *u, pa_object *o, struct 
filter* filter, bool restore,
+static void move_objects_for_filter(struct userdata *u, pa_object *o, struct 
filter *filter, bool restore,
 bool is_sink_input) {
 
 if (!should_group_filter(filter))
@@ -431,7 +493,7 @@ static bool can_unload_module(struc

[pulseaudio-commits] Branch 'next' - src/modules src/tests

2017-01-03 Thread Tanu Kaskinen
 src/modules/alsa/alsa-util.c |5 -
 src/tests/alsa-time-test.c   |3 ---
 2 files changed, 8 deletions(-)

New commits:
commit e1a11a5fd1b5d8c0494713223e0136aa08769ef2
Author: Takashi Sakamoto 
Date:   Fri Dec 30 12:05:20 2016 +0900

alsa: remove double calls of snd_pcm_prepare()

In alsa-lib, snd_pcm_hw_params() internally calls snd_pcm_prepare(), thus
user space applications have no need to call snd_pcm_prepare() after calls
of snd_pcm_hw_params(). An explicit calls of snd_pcm_prepare() is expected
in a case to recover PCM substreams.

Current implementation of PulseAudio modules for ALSA playbacking/capturing
results in double calls of snd_pcm_prepare(). The second call for hw plugin
of alsa-lib executes ioctl(2) with SNDRV_PCM_IOCTL_PREPARE command in state
of SNDRV_PCM_STATE_PREPARED for the PCM substream. This has no effects to
the PCM substream as long as corresponding drivers are implemented
correctly.

This commit removes the second call for the reason.

Signed-off-by: Takashi Sakamoto 

diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index dfb2aa7..63d370f 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -410,11 +410,6 @@ success:
 if (ss->format != _ss.format)
 pa_log_info("Device %s doesn't support sample format %s, changed to 
%s.", snd_pcm_name(pcm_handle), pa_sample_format_to_string(ss->format), 
pa_sample_format_to_string(_ss.format));
 
-if ((ret = snd_pcm_prepare(pcm_handle)) < 0) {
-pa_log_info("snd_pcm_prepare() failed: %s", pa_alsa_strerror(ret));
-goto finish;
-}
-
 if ((ret = snd_pcm_hw_params_current(pcm_handle, hwparams)) < 0) {
 pa_log_info("snd_pcm_hw_params_current() failed: %s", 
pa_alsa_strerror(ret));
 goto finish;
diff --git a/src/tests/alsa-time-test.c b/src/tests/alsa-time-test.c
index a877cb8..dff95bb 100644
--- a/src/tests/alsa-time-test.c
+++ b/src/tests/alsa-time-test.c
@@ -132,9 +132,6 @@ int main(int argc, char *argv[]) {
 r = snd_pcm_sw_params(pcm, swparams);
 assert(r == 0);
 
-r = snd_pcm_prepare(pcm);
-assert(r == 0);
-
 r = snd_pcm_sw_params_current(pcm, swparams);
 assert(r == 0);
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2017-01-03 Thread Tanu Kaskinen
 src/modules/bluetooth/backend-native.c |   28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

New commits:
commit 15cf273ed89f2fc6a0271eed494a489f8ca4f56a
Author: Renjith Thomas 
Date:   Thu Dec 15 12:34:14 2016 +0530

bluetooth: fix distorted audio during Bluetooth SCO HFP/HSP playback

Issue: When HFP/HSP profile is used with certain BT chipsets, the
audio sounds heavily distorted, with very slow playback full of noise.
During recording, the samples are dropped and it distorts the recorded
audio samples.

The root cause of both the issues are related to the fixed MTU sizes
in the PA stack, which is 48 bytes. Here, the BT chipset CC256x had
180 bytes MTU and it was being under-utilized and the rate at which
the samples were being accepted where not matching the expected rate,
and hence the distortion.

Solution: The appropriate solution to this problem is by reading the
MTU size of the SCO socket using getsockopts dynamically.

BugLink: http://bit.ly/2gDpGPv
BugLink: http://bit.ly/2hQsARK

diff --git a/src/modules/bluetooth/backend-native.c 
b/src/modules/bluetooth/backend-native.c
index cf88126..4974c3f 100644
--- a/src/modules/bluetooth/backend-native.c
+++ b/src/modules/bluetooth/backend-native.c
@@ -103,6 +103,8 @@ static pa_dbus_pending* 
send_and_add_to_pending(pa_bluetooth_backend *backend, D
 static int bluez5_sco_acquire_cb(pa_bluetooth_transport *t, bool optional, 
size_t *imtu, size_t *omtu) {
 pa_bluetooth_device *d = t->device;
 struct sockaddr_sco addr;
+struct sco_options sco_opt;
+socklen_t len;
 int err, i;
 int sock;
 bdaddr_t src;
@@ -124,34 +126,40 @@ static int bluez5_sco_acquire_cb(pa_bluetooth_transport 
*t, bool optional, size_
 return -1;
 }
 
-memset(&addr, 0, sizeof(addr));
+len = sizeof(addr);
+memset(&addr, 0, len);
 addr.sco_family = AF_BLUETOOTH;
 bacpy(&addr.sco_bdaddr, &src);
 
-if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+if (bind(sock, (struct sockaddr *) &addr, len) < 0) {
 pa_log_error("bind(): %s", pa_cstrerror(errno));
 goto fail_close;
 }
 
-memset(&addr, 0, sizeof(addr));
+memset(&addr, 0, len);
 addr.sco_family = AF_BLUETOOTH;
 bacpy(&addr.sco_bdaddr, &dst);
 
 pa_log_info("doing connect");
-err = connect(sock, (struct sockaddr *) &addr, sizeof(addr));
+err = connect(sock, (struct sockaddr *) &addr, len);
 if (err < 0 && !(errno == EAGAIN || errno == EINPROGRESS)) {
 pa_log_error("connect(): %s", pa_cstrerror(errno));
 goto fail_close;
 }
 
-/* The "48" below is hardcoded until we get meaningful MTU values exposed
- * by the kernel */
+len = sizeof(sco_opt);
+memset(&sco_opt, 0, len);
 
-if (imtu)
-*imtu = 48;
+if (getsockopt(sock, SOL_SCO, SCO_OPTIONS, &sco_opt, &len) < 0) {
+pa_log_warn("getsockopt(SCO_OPTIONS) failed, loading defaults");
 
-if (omtu)
-*omtu = 48;
+/* Setting defaults in case of error */
+if (imtu) *imtu = 48;
+if (omtu) *omtu = 48;
+} else {
+if (imtu) *imtu = sco_opt.mtu;
+if (omtu) *omtu = sco_opt.mtu;
+}
 
 return sock;
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2016-11-11 Thread Tanu Kaskinen
 src/modules/x11/module-x11-bell.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit ce4b3603aea1b4e83ce6324b81abfe75f2bf78ec
Author: Tanu Kaskinen 
Date:   Thu Nov 10 13:22:04 2016 +0200

x11-bell: ignore volume from X11

X11 has its own bell volume setting, controlled with the "xset b"
command. If we use that volume, then the "System Sounds" slider in
pavucontrol doesn't affect the x11-bell sample volume, which in my
opinion is a bad thing. Ignoring the volume suggestion from X11 allows
module-stream-restore to apply the "event" role volume.

diff --git a/src/modules/x11/module-x11-bell.c 
b/src/modules/x11/module-x11-bell.c
index 6c9f580..7b2be57 100644
--- a/src/modules/x11/module-x11-bell.c
+++ b/src/modules/x11/module-x11-bell.c
@@ -76,7 +76,10 @@ static int x11_event_cb(pa_x11_wrapper *w, XEvent *e, void 
*userdata) {
 
 bne = (XkbBellNotifyEvent*) e;
 
-if (pa_scache_play_item_by_name(u->core, u->scache_item, u->sink_name, 
((pa_volume_t) bne->percent*PA_VOLUME_NORM)/100U, NULL, NULL) < 0) {
+/* We could use bne->percent to set the volume, but then the "event" role
+ * volume wouldn't have effect. It's better to ignore the volume suggestion
+ * from X11. */
+if (pa_scache_play_item_by_name(u->core, u->scache_item, u->sink_name, 
PA_VOLUME_INVALID, NULL, NULL) < 0) {
 pa_log_info("Ringing bell failed, reverting to X11 device bell.");
 XkbForceDeviceBell(pa_x11_wrapper_get_display(w), bne->device, 
bne->bell_class, bne->bell_id, bne->percent);
 }

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2016-10-26 Thread Arun Raghavan
 src/modules/bluetooth/module-bluetooth-policy.c |   43 
 1 file changed, 30 insertions(+), 13 deletions(-)

New commits:
commit b245fb41e17a4c74a2226f9202788aa883a340e9
Author: Pali Rohár 
Date:   Sun Sep 11 16:41:02 2016 +0200

bluetooth: Add optional heuristic for switching between hsp and a2dp 
profiles

Not all VOIP applications (specially those which use alsa) set media.role to
phone. This means we need some heuristic to determinate if we want to switch
from a2dp to hsp profile based on number and types of source output 
(recording)
streams.

And also some people want to use their bluetooth headset (with microphone) 
as
their default recording device but some do not want to because of low 
quality.

This patch implements optional heuristic which is disabled by default. It is
disabled by default to not break experience of current pulseaudio users 
because
heuristic cannot be optimal. Heuristic is implemented in 
module-bluetooth-policy
module and decide if pulseaudio should switch to a hsp profile or not. It 
checks
if there is some source output with pass all these conditions:

* does not have set media.role
* does not use peak resample method (which is used by desktop volume 
programs)
* has assigned client/application (non virtual stream)
* does not record from monitor of sink

And if yes it switch to hsp profile.

By default this heuristic is disabled and can be enabled when loading module
module-bluetooth-policy with specifying parameter auto_switch=2

Because it is disabled by default nobody will be affected by this change 
unless
manually change auto_switch parameter.

Signed-off-by: Pali Rohár 

diff --git a/src/modules/bluetooth/module-bluetooth-policy.c 
b/src/modules/bluetooth/module-bluetooth-policy.c
index e62a114..bedf011 100644
--- a/src/modules/bluetooth/module-bluetooth-policy.c
+++ b/src/modules/bluetooth/module-bluetooth-policy.c
@@ -38,7 +38,7 @@ PA_MODULE_DESCRIPTION("Policy module to make using bluetooth 
devices out-of-the-
 PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(true);
 PA_MODULE_USAGE(
-"auto_switch= "
+"auto_switch= "
 "a2dp_source= "
 "ag= "
 "hfgw= DEPRECATED");
@@ -52,6 +52,7 @@ static const char* const valid_modargs[] = {
 };
 
 struct userdata {
+uint32_t auto_switch;
 bool enable_a2dp_source;
 bool enable_ag;
 pa_hook_slot *source_put_slot;
@@ -214,7 +215,8 @@ static void switch_profile(pa_card *card, bool 
revert_to_a2dp, void *userdata) {
 }
 
 /* Return true if we should ignore this source output */
-static bool ignore_output(pa_source_output *source_output) {
+static bool ignore_output(pa_source_output *source_output, void *userdata) {
+struct userdata *u = userdata;
 const char *s;
 
 /* New applications could set media.role for identifying streams */
@@ -223,16 +225,32 @@ static bool ignore_output(pa_source_output 
*source_output) {
 if (s)
 return !pa_streq(s, "phone");
 
-return true;
+/* If media.role is not set use some heuristic (if enabled) */
+if (u->auto_switch != 2)
+return true;
+
+/* Ignore if resample method is peaks (used by desktop volume programs) */
+if (pa_source_output_get_resample_method(source_output) == 
PA_RESAMPLER_PEAKS)
+return true;
+
+/* Ignore if there is no client/application assigned (used by virtual 
stream) */
+if (!source_output->client)
+return true;
+
+/* Ignore if recording from monitor of sink */
+if (source_output->direct_on_input)
+return true;
+
+return false;
 }
 
-static unsigned source_output_count(pa_core *c) {
+static unsigned source_output_count(pa_core *c, void *userdata) {
 pa_source_output *source_output;
 uint32_t idx;
 unsigned count = 0;
 
 PA_IDXSET_FOREACH(source_output, c->source_outputs, idx)
-if (!ignore_output(source_output))
+if (!ignore_output(source_output, userdata))
 ++count;
 
 return count;
@@ -252,7 +270,7 @@ static pa_hook_result_t 
source_output_put_hook_callback(pa_core *c, pa_source_ou
 pa_assert(c);
 pa_assert(source_output);
 
-if (ignore_output(source_output))
+if (ignore_output(source_output, userdata))
 return PA_HOOK_OK;
 
 switch_profile_all(c->cards, false, userdata);
@@ -264,11 +282,11 @@ static pa_hook_result_t 
source_output_unlink_hook_callback(pa_core *c, pa_source
 pa_assert(c);
 pa_assert(source_output);
 
-if (ignore_output(source_output))
+if (ignore_output(source_output, userdata))
 return PA_HOOK_OK;
 
 /* If there are still some source outputs do nothing (count is with *this* 
source_output, so +1) */
-if (source_output_count(c) > 1)
+if (source_output_count(c, userdata) > 1)
 return PA_HOOK_OK;
 
 switch_profile_all(c->cards, true, userdata);

[pulseaudio-commits] Branch 'next' - src/modules

2016-06-05 Thread Tanu Kaskinen
 src/modules/echo-cancel/webrtc.cc |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit cae9a1123c6df3afa9b8a7e3d0b5bb57e725bff1
Author: Tanu Kaskinen 
Date:   Thu Jun 2 16:00:51 2016 +0300

webrtc: improve comment about mic geometry

The first mic channel position is not relevant for the target
direction definition.

diff --git a/src/modules/echo-cancel/webrtc.cc 
b/src/modules/echo-cancel/webrtc.cc
index db6873d..aadb1af 100644
--- a/src/modules/echo-cancel/webrtc.cc
+++ b/src/modules/echo-cancel/webrtc.cc
@@ -184,8 +184,8 @@ static bool parse_mic_geometry(const char **mic_geometry, 
std::vectorhttps://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2016-05-26 Thread Arun Raghavan
 src/modules/module-ladspa-sink.c |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 8eab8dabc4c18b9717c527f0adb67aa23c72c06c
Author: KimJeongYeon 
Date:   Thu May 19 11:35:44 2016 +0900

ladspa-sink: avoid to configure invalid format

LADSPA allows float format only, but module-ladspa-sink possibly
could be loaded with ***any*** 'format' parameter. Therefore noisy
sound heard. This patch avoids to be configured as invalid format.

Signed-off-by: KimJeongYeon 
Signed-off-by: Arun Raghavan 

diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index 38b94e3..a6290b9 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -981,6 +981,11 @@ int pa__init(pa_module*m) {
 goto fail;
 }
 
+if (ss.format != PA_SAMPLE_FLOAT32) {
+pa_log("LADSPA accepts float format only");
+goto fail;
+}
+
 if (!(plugin = pa_modargs_get_value(ma, "plugin", NULL))) {
 pa_log("Missing LADSPA plugin name");
 goto fail;

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2016-05-23 Thread Tanu Kaskinen
 src/modules/alsa/alsa-sink.c|9 +
 src/modules/alsa/alsa-source.c  |9 +
 src/modules/alsa/module-alsa-card.c |8 
 3 files changed, 26 insertions(+)

New commits:
commit efb14524a210e84fff573753f697b3c9baaa67a3
Author: Alexander E. Patrakov 
Date:   Sun May 22 02:03:21 2016 +0500

alsa: reread configuration when opening new devices

If a card has been hot-plugged after pulseaudio start, alsa-lib still has
old configuration in memory, which doesn't have PCM definitions for the
new card. Thus, this error appears, and the device doesn't work:

I: [pulseaudio] (alsa-lib)confmisc.c: Unable to find definition 
'cards.USB-Audio.pcm.front.0:CARD=0'
I: [pulseaudio] (alsa-lib)conf.c: function snd_func_refer returned error: 
No such file or directory
I: [pulseaudio] (alsa-lib)conf.c: Evaluate error: No such file or directory
I: [pulseaudio] (alsa-lib)pcm.c: Unknown PCM front:0
I: [pulseaudio] alsa-util.c: Error opening PCM device front:0: No such file 
or directory

The snd_config_update_free_global() function makes alsa-lib forget any
cached configuration and reparse all PCM definitions from scratch next
time it is told to open anything.

The trick has been copied from Phonon.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=54029
Signed-off-by: Alexander E. Patrakov 

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 2fdebe0..63674e2 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2146,6 +2146,15 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, 
const char*driver, pa_ca
 b = use_mmap;
 d = use_tsched;
 
+/* Force ALSA to reread its configuration if module-alsa-card didn't
+ * do it for us. This matters if our device was hot-plugged after ALSA
+ * has already read its configuration - see
+ * https://bugs.freedesktop.org/show_bug.cgi?id=54029
+ */
+
+if (!card)
+snd_config_update_free_global();
+
 if (mapping) {
 
 if (!(dev_id = pa_modargs_get_value(ma, "device_id", NULL))) {
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 4683dfe..0820b48 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1854,6 +1854,15 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs 
*ma, const char*driver, p
 b = use_mmap;
 d = use_tsched;
 
+/* Force ALSA to reread its configuration if module-alsa-card didn't
+ * do it for us. This matters if our device was hot-plugged after ALSA
+ * has already read its configuration - see
+ * https://bugs.freedesktop.org/show_bug.cgi?id=54029
+ */
+
+if (!card)
+snd_config_update_free_global();
+
 if (mapping) {
 
 if (!(dev_id = pa_modargs_get_value(ma, "device_id", NULL))) {
diff --git a/src/modules/alsa/module-alsa-card.c 
b/src/modules/alsa/module-alsa-card.c
index 286cfc9..45ac263 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -686,6 +686,14 @@ int pa__init(pa_module *m) {
 }
 
 pa_modargs_get_value_boolean(u->modargs, "use_ucm", &u->use_ucm);
+
+/* Force ALSA to reread its configuration. This matters if our device
+ * was hot-plugged after ALSA has already read its configuration - see
+ * https://bugs.freedesktop.org/show_bug.cgi?id=54029
+ */
+
+snd_config_update_free_global();
+
 if (u->use_ucm && !pa_alsa_ucm_query_profiles(&u->ucm, 
u->alsa_card_index)) {
 pa_log_info("Found UCM profiles");
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2016-01-17 Thread Arun Raghavan
 src/modules/module-solaris.c |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit eee7f0422e186b281617efcc466afe2ae86f4d03
Author: Jonathan Perkin 
Date:   Mon Dec 21 04:10:34 2015 +0100

solaris: Catch up with newer API

Patch upstreamed from pkgsrc by Kamil Rytarowski .

See commit e4a7625ba884c5cce20468d75937857343751c35 for why this was
originally done.

diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index c79918a..2fa0bff 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -412,10 +412,12 @@ static int sink_process_msg(pa_msgobject *o, int code, 
void *data, int64_t offse
 pa_smoother_resume(u->smoother, pa_rtclock_now(), 
true);
 
 if (!u->source || u->source_suspended) {
+bool mute;
 if (unsuspend(u) < 0)
 return -1;
 u->sink->get_volume(u->sink);
-u->sink->get_mute(u->sink);
+if (u->sink->get_mute(u->sink, &mute) >= 0)
+pa_sink_set_mute(u->sink, mute, false);
 }
 u->sink_suspended = false;
 }
@@ -1033,8 +1035,12 @@ int pa__init(pa_module *m) {
 
 if (sink_new_data.muted_is_set)
 u->sink->set_mute(u->sink);
-else
-u->sink->get_mute(u->sink);
+else {
+bool mute;
+
+if (u->sink->get_mute(u->sink, &mute) >= 0)
+pa_sink_set_mute(u->sink, mute, false);
+}
 
 pa_sink_put(u->sink);
 }

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2015-09-17 Thread Tanu Kaskinen
 src/modules/bluetooth/module-bluez4-device.c |9 -
 1 file changed, 9 deletions(-)

New commits:
commit 101c1ca307452f05c011c485078fb119e9e0caef
Author: Manish Sogi 
Date:   Mon Jun 15 17:46:05 2015 +0530

bluetooth: bluez4: Remove the unused "auto_connect" parameter as it is not 
used in bluez4


Signed-off-by: Manish Sogi 

diff --git a/src/modules/bluetooth/module-bluez4-device.c 
b/src/modules/bluetooth/module-bluez4-device.c
index db69d34..a23c2a9 100644
--- a/src/modules/bluetooth/module-bluez4-device.c
+++ b/src/modules/bluetooth/module-bluez4-device.c
@@ -75,7 +75,6 @@ PA_MODULE_USAGE(
 "rate= "
 "channels= "
 "path= "
-"auto_connect= "
 "sco_sink= "
 "sco_source=");
 
@@ -94,7 +93,6 @@ static const char* const valid_modargs[] = {
 "rate",
 "channels",
 "path",
-"auto_connect",
 "sco_sink",
 "sco_source",
 NULL
@@ -148,7 +146,6 @@ struct userdata {
 pa_hook_slot *transport_speaker_changed_slot;
 
 pa_bluez4_discovery *discovery;
-bool auto_connect;
 
 char *output_port_name;
 char *input_port_name;
@@ -2460,12 +2457,6 @@ int pa__init(pa_module *m) {
 goto fail;
 }
 
-u->auto_connect = true;
-if (pa_modargs_get_value_boolean(ma, "auto_connect", &u->auto_connect)) {
-pa_log("Failed to parse auto_connect= argument");
-goto fail;
-}
-
 channels = u->sample_spec.channels;
 if (pa_modargs_get_value_u32(ma, "channels", &channels) < 0 ||
 !pa_channels_valid(channels)) {

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2015-08-10 Thread Tanu Kaskinen
 src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit bc77487ee78d581f193c9219ecce334e001a89d6
Author: Tanu Kaskinen 
Date:   Mon Aug 10 17:22:38 2015 +0200

alsa-mixer: sb-omni-surround-5.1.conf: remove analog-surround-40 mapping

It was reported that the 4.0 mode doesn't work properly:

http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/23677/focus=23904

diff --git a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf 
b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
index 84d8483..5795067 100644
--- a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
+++ b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
@@ -43,13 +43,6 @@ paths-output = analog-output
 priority = 5
 direction = output
 
-[Mapping analog-surround-40]
-device-strings = surround40:%f
-channel-map = front-left,front-right,rear-left,rear-right
-paths-output = analog-output
-priority = 6
-direction = output
-
 [Mapping analog-surround-41]
 device-strings = surround41:%f
 channel-map = front-left,front-right,rear-left,rear-right,lfe

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2015-08-06 Thread Tanu Kaskinen
 src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit a77df1a54a625cb69b9a58627fbbc0401c8c96c3
Author: Tanu Kaskinen 
Date:   Thu Aug 6 12:13:54 2015 +0200

alsa-mixer: sb-omni-surround-5.1.conf: rename analog-stereo to 
analog-stereo-output

The mapping is only useful for output, and this renaming makes the
name symmetric with the input mapping.

diff --git a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf 
b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
index 1c4aa7b..84d8483 100644
--- a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
+++ b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf
@@ -23,11 +23,12 @@
 [General]
 auto-profiles = yes
 
-[Mapping analog-stereo]
+[Mapping analog-stereo-output]
 device-strings = front:%f hw:%f
 channel-map = left,right
 paths-output = analog-output
 priority = 10
+direction = output
 
 [Mapping analog-stereo-input]
 device-strings = hw:%f,1,0
@@ -75,4 +76,4 @@ device-strings = iec958:%f
 channel-map = left,right
 paths-output = iec958-stereo-output
 priority = 5
-direction = output
\ No newline at end of file
+direction = output

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2014-02-28 Thread David Henningsson
 src/modules/module-suspend-on-idle.c |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit cfccf0ee45a8b9a83cd440ac71a638fb799f05c5
Author: David Henningsson 
Date:   Tue Feb 25 16:56:49 2014 +0100

suspend-on-idle: Ensure we still time out if a stream remains corked

If a stream is started corked and remains corked, the sink/source
remained idle without being properly suspended. This patch fixes
that issue.

BugLink: https://bugs.launchpad.net/bugs/1284415
Tested-by: Ricardo Salveti 
Signed-off-by: David Henningsson 

diff --git a/src/modules/module-suspend-on-idle.c 
b/src/modules/module-suspend-on-idle.c
index 0585e51..959de43 100644
--- a/src/modules/module-suspend-on-idle.c
+++ b/src/modules/module-suspend-on-idle.c
@@ -141,10 +141,14 @@ static pa_hook_result_t sink_input_fixate_hook_cb(pa_core 
*c, pa_sink_input_new_
 
 /* We need to resume the audio device here even for
  * PA_SINK_INPUT_START_CORKED, since we need the device parameters
- * to be fully available while the stream is set up. */
+ * to be fully available while the stream is set up. In that case,
+ * make sure we close the sink again after the timeout interval. */
 
-if ((d = pa_hashmap_get(u->device_infos, data->sink)))
+if ((d = pa_hashmap_get(u->device_infos, data->sink))) {
 resume(d);
+if (pa_sink_check_suspend(d->sink) <= 0)
+restart(d);
+}
 
 return PA_HOOK_OK;
 }
@@ -161,8 +165,11 @@ static pa_hook_result_t 
source_output_fixate_hook_cb(pa_core *c, pa_source_outpu
 else
 d = pa_hashmap_get(u->device_infos, data->source);
 
-if (d)
+if (d) {
 resume(d);
+if (pa_source_check_suspend(d->source) <= 0)
+restart(d);
+}
 
 return PA_HOOK_OK;
 }

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2014-02-11 Thread Tanu Kaskinen
 src/modules/dbus/iface-card.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f1737ad0dbd9634d4e0a79261e46de93ac2d61dd
Author: Juho Hämäläinen 
Date:   Mon Feb 10 12:46:28 2014 +0200

dbus: Use correct idxset when getting sources

This fixes get_sources() which iterates wrong idxset when
getting source object paths in GetSources or GetAll.

diff --git a/src/modules/dbus/iface-card.c b/src/modules/dbus/iface-card.c
index b77a5e4..2d46154 100644
--- a/src/modules/dbus/iface-card.c
+++ b/src/modules/dbus/iface-card.c
@@ -243,7 +243,7 @@ static const char **get_sources(pa_dbusiface_card *c, 
unsigned *n) {
 
 sources = pa_xnew(const char *, *n);
 
-PA_IDXSET_FOREACH(source, c->card->sinks, idx) {
+PA_IDXSET_FOREACH(source, c->card->sources, idx) {
 sources[i] = pa_dbusiface_core_get_source_path(c->core, source);
 ++i;
 }

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2014-02-07 Thread Tanu Kaskinen
 src/modules/alsa/alsa-mixer.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bd51c7220854f04acfdc75a5c8fa0e660e4738f3
Author: Tanu Kaskinen 
Date:   Wed Jan 29 20:59:00 2014 +0200

alsa: Remove a redundant check

If mixer_handle is not NULL, then hctl_handle won't be NULL either.
The redundant check was confusing, because it looked like we would
leak the mixer_handle if mixer_handle is non-NULL and hctl_handle is
NULL.

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 99de0ec..4357e52 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -3776,8 +3776,8 @@ static void mapping_paths_probe(pa_alsa_mapping *m, 
pa_alsa_profile *profile,
 pa_assert(pcm_handle);
 
 mixer_handle = pa_alsa_open_mixer_for_pcm(pcm_handle, NULL, &hctl_handle);
-if (!mixer_handle || !hctl_handle) {
- /* Cannot open mixer, remove all entries */
+if (!mixer_handle) {
+/* Cannot open mixer, remove all entries */
 pa_hashmap_remove_all(ps->paths);
 return;
 }

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2014-01-26 Thread Tanu Kaskinen
 src/modules/module-device-manager.c |4 
 1 file changed, 4 insertions(+)

New commits:
commit 95f2e8e322b802a6dace189b73a2a1a6a9c899ce
Author: Tanu Kaskinen 
Date:   Sun Jan 26 20:13:50 2014 +0200

device-manager: Don't try to use unlinked devices

This fixes an assertion crash:

[pulseaudio] source.c: Assertion 'PA_SOURCE_IS_LINKED(s->state)' failed at 
pulsecore/source.c:734, function pa_source_update_status(). Aborting.

The crash happened when a Bluetooth headset profile was changed from
a2dp to hsp. During the profile change three devices are created:
a sink, a monitor source for the sink, and a regular source. First
pa_sink/source_new() are called for each device, and that puts the
devices to u->core->sinks/sources. Then, pa_sink_put() is called for
the sink, and that in turn calls pa_source_put() for the source. At
that point module-device-manager decides to reroute all source
outputs. The non-monitor source that the Bluetooth card created hasn't
been linked yet at this stage, because it will only be linked after
the sink and the monitor source have been linked. So,
module-device-manager should take into account during the rerouting
that not all sinks and sources are necessarily linked. This patch does
that.

Reported-By: Iskren Hadzhinedev 

diff --git a/src/modules/module-device-manager.c 
b/src/modules/module-device-manager.c
index 9df3d8e..d86c158 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -605,6 +605,8 @@ static void update_highest_priority_device_indexes(struct 
userdata *u, const cha
 PA_IDXSET_FOREACH(sink, u->core->sinks, idx) {
 if ((pa_sink*) ignore_device == sink)
 continue;
+if (!PA_SINK_IS_LINKED(sink->state))
+continue;
 if (pa_streq(sink->name, device_name)) {
 found = true;
 idx = sink->index; /* Is this needed? */
@@ -617,6 +619,8 @@ static void update_highest_priority_device_indexes(struct 
userdata *u, const cha
 PA_IDXSET_FOREACH(source, u->core->sources, idx) {
 if ((pa_source*) ignore_device == source)
 continue;
+if (!PA_SOURCE_IS_LINKED(source->state))
+continue;
 if (pa_streq(source->name, device_name)) {
 found = true;
 idx = source->index; /* Is this needed? */

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-05-29 Thread Tanu Kaskinen
 src/modules/macosx/module-coreaudio-device.c |   33 ++-
 1 file changed, 23 insertions(+), 10 deletions(-)

New commits:
commit 7957aa42a363acbf973b291fc9920de72a8c3969
Author: Tanu Kaskinen 
Date:   Wed May 29 13:58:36 2013 +0300

osx: Fix latency querying

get_latency_us() used an uninitialized variable, and an incorrect
scope for some of the AudioObjectGetPropertyData() calls. As a result,
audio would randomly not work at all.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=65122

diff --git a/src/modules/macosx/module-coreaudio-device.c 
b/src/modules/macosx/module-coreaudio-device.c
index ea88ebd..b1a5176 100644
--- a/src/modules/macosx/module-coreaudio-device.c
+++ b/src/modules/macosx/module-coreaudio-device.c
@@ -183,7 +183,7 @@ static pa_usec_t get_latency_us(pa_object *o) {
 struct userdata *u;
 pa_sample_spec *ss;
 bool is_source;
-UInt32 v, total = 0;
+UInt32 v = 0, total = 0;
 UInt32 err, size = sizeof(v);
 AudioObjectPropertyAddress property_address;
 AudioObjectID stream_id;
@@ -205,26 +205,35 @@ static pa_usec_t get_latency_us(pa_object *o) {
 
 pa_assert(u);
 
-property_address.mScope = kAudioObjectPropertyScopeGlobal;
+property_address.mScope = is_source ? kAudioDevicePropertyScopeInput : 
kAudioDevicePropertyScopeOutput;
 property_address.mElement = kAudioObjectPropertyElementMaster;
 
 /* get the device latency */
 property_address.mSelector = kAudioDevicePropertyLatency;
-size = sizeof(total);
-AudioObjectGetPropertyData(u->object_id, &property_address, 0, NULL, 
&size, &total);
-total += v;
+size = sizeof(v);
+err = AudioObjectGetPropertyData(u->object_id, &property_address, 0, NULL, 
&size, &v);
+if (!err)
+total += v;
+else
+pa_log_warn("Failed to get device latency: %i", err);
 
 /* the IOProc buffer size */
 property_address.mSelector = kAudioDevicePropertyBufferFrameSize;
 size = sizeof(v);
-AudioObjectGetPropertyData(u->object_id, &property_address, 0, NULL, 
&size, &v);
-total += v;
+err = AudioObjectGetPropertyData(u->object_id, &property_address, 0, NULL, 
&size, &v);
+if (!err)
+total += v;
+else
+pa_log_warn("Failed to get buffer frame size: %i", err);
 
 /* IOProc safety offset - this value is the same for both directions, 
hence we divide it by 2 */
 property_address.mSelector = kAudioDevicePropertySafetyOffset;
 size = sizeof(v);
-AudioObjectGetPropertyData(u->object_id, &property_address, 0, NULL, 
&size, &v);
-total += v / 2;
+err = AudioObjectGetPropertyData(u->object_id, &property_address, 0, NULL, 
&size, &v);
+if (!err)
+total += v / 2;
+else
+pa_log_warn("Failed to get safety offset: %i", err);
 
 /* get the stream latency.
  * FIXME: this assumes the stream latency is the same for all streams */
@@ -233,11 +242,15 @@ static pa_usec_t get_latency_us(pa_object *o) {
 err = AudioObjectGetPropertyData(u->object_id, &property_address, 0, NULL, 
&size, &stream_id);
 if (!err) {
 property_address.mSelector = kAudioStreamPropertyLatency;
+property_address.mScope = kAudioObjectPropertyScopeGlobal;
 size = sizeof(v);
 err = AudioObjectGetPropertyData(stream_id, &property_address, 0, 
NULL, &size, &v);
 if (!err)
 total += v;
-}
+else
+pa_log_warn("Failed to get stream latency: %i", err);
+} else
+pa_log_warn("Failed to get streams: %i", err);
 
 return pa_bytes_to_usec(total * pa_frame_size(ss), ss);
 }

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-05-24 Thread Tanu Kaskinen
 src/modules/bluetooth/module-bluetooth-device.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e4779d836b9012d71c15fb3841edcd15f177ee52
Author: Tanu Kaskinen 
Date:   Fri May 24 15:17:13 2013 +0300

bluetooth: Fix input port description

diff --git a/src/modules/bluetooth/module-bluetooth-device.c 
b/src/modules/bluetooth/module-bluetooth-device.c
index c82cb53..f82033a 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2147,7 +2147,7 @@ static void create_card_ports(struct userdata *u, 
pa_hashmap *ports) {
 
 pa_device_port_new_data_init(&port_data);
 pa_device_port_new_data_set_name(&port_data, u->input_port_name);
-pa_device_port_new_data_set_description(&port_data, output_description);
+pa_device_port_new_data_set_description(&port_data, input_description);
 pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_INPUT);
 pa_device_port_new_data_set_available(&port_data, get_port_availability(u, 
PA_DIRECTION_INPUT));
 pa_assert_se(port = pa_device_port_new(u->core, &port_data, 0));

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-05-17 Thread David Henningsson
 src/modules/alsa/mixer/paths/analog-output.conf |8 
 1 file changed, 8 insertions(+)

New commits:
commit d614cba04e6b61a12879f3f3e5d514da99f63f7a
Author: David Henningsson 
Date:   Thu May 16 10:56:21 2013 +0200

alsa-mixer: Add "Line Out Jack" to analog-output.conf

A stationary computer usually has headphone jack(s) and line out jacks.
In some cases analog-output.conf will be a subset of
analog-output-headphones.conf, causing line outs to be unusable (because
headphones are unplugged).

This late in the cycle, this was the safest way I could think of to try
to fix this for a particular computer. In later versions of PulseAudio
we could consider making a dedicated line out path instead, and have
proper jack detection there.

Signed-off-by: David Henningsson 

diff --git a/src/modules/alsa/mixer/paths/analog-output.conf 
b/src/modules/alsa/mixer/paths/analog-output.conf
index 1b7482c..3a552c9 100644
--- a/src/modules/alsa/mixer/paths/analog-output.conf
+++ b/src/modules/alsa/mixer/paths/analog-output.conf
@@ -22,6 +22,14 @@
 [General]
 priority = 99
 
+[Jack Line Out]
+state.plugged = unknown
+state.unplugged = unknown
+
+[Jack Line Out Phantom]
+state.plugged = unknown
+state.unplugged = unknown
+
 [Element Hardware Master]
 switch = mute
 volume = merge

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-05-14 Thread David Henningsson
 src/modules/alsa/module-alsa-card.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 21b57d9978627df2b37937a04dd445e80e834663
Author: David Henningsson 
Date:   Tue May 14 11:01:13 2013 +0200

alsa: Fix crash when profile_set == NULL

Better check if the pointer is NULL before dereferencing it, instead of
after!

BugLink: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1159853
Signed-off-by: David Henningsson 

diff --git a/src/modules/alsa/module-alsa-card.c 
b/src/modules/alsa/module-alsa-card.c
index b37eabc..fe05e3d 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -689,11 +689,11 @@ int pa__init(pa_module *m) {
 pa_xfree(fn);
 }
 
-u->profile_set->ignore_dB = ignore_dB;
-
 if (!u->profile_set)
 goto fail;
 
+u->profile_set->ignore_dB = ignore_dB;
+
 pa_alsa_profile_set_probe(u->profile_set, u->device_id, 
&m->core->default_sample_spec, m->core->default_n_fragments, 
m->core->default_fragment_size_msec);
 pa_alsa_profile_set_dump(u->profile_set);
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-05-12 Thread Arun Raghavan
 src/modules/echo-cancel/module-echo-cancel.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9d825ea84ec1340029a515cdd16ca12e4df3b9de
Author: Peter Meerwald 
Date:   Mon Apr 22 15:36:12 2013 +0200

echo-cancel: Fix send/recv_counter in calc_diff()

send_counter/recv_counter relate to the bytes (play stream) passed
through the queue, hence the same sample spec must be used

Signed-off-by: Peter Meerwald 
Acked-by: Stefan Huber 

diff --git a/src/modules/echo-cancel/module-echo-cancel.c 
b/src/modules/echo-cancel/module-echo-cancel.c
index b77dffd..b45a40c 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -312,8 +312,8 @@ static int64_t calc_diff(struct userdata *u, struct 
snapshot *snapshot) {
 buffer_latency += source_delay + sink_delay;
 
 /* add the latency difference due to samples not yet transferred */
-send_counter = pa_bytes_to_usec(snapshot->send_counter, 
&u->sink_input->sample_spec);
-recv_counter = pa_bytes_to_usec(snapshot->recv_counter, 
&u->source_output->sample_spec);
+send_counter = pa_bytes_to_usec(snapshot->send_counter, 
&u->sink->sample_spec);
+recv_counter = pa_bytes_to_usec(snapshot->recv_counter, 
&u->sink->sample_spec);
 if (recv_counter <= send_counter)
 buffer_latency += (int64_t) (send_counter - recv_counter);
 else

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-05-08 Thread Tanu Kaskinen
 src/modules/alsa/mixer/profile-sets/default.conf|2 +-
 src/modules/alsa/mixer/profile-sets/extra-hdmi.conf |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6e673f42a4c4013fa3c78de2fe3c1d083d662f5b
Author: Tanu Kaskinen 
Date:   Wed Sep 12 16:03:59 2012 +0300

alsa-mixer: Don't use the mono path in the analog-stereo mapping.

As far as I can see, having a mono path in a stereo mapping doesn't
make any sense. It also causes breakage: if the Master Mono mixer
element has two volume channels, the analog-output path gets removed
due to being a subset of analog-output-mono, and that in turn causes
the Master element getting muted. Users generally don't like that.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=54673

diff --git a/src/modules/alsa/mixer/profile-sets/default.conf 
b/src/modules/alsa/mixer/profile-sets/default.conf
index c805d36..3599535 100644
--- a/src/modules/alsa/mixer/profile-sets/default.conf
+++ b/src/modules/alsa/mixer/profile-sets/default.conf
@@ -108,7 +108,7 @@ priority = 1
 [Mapping analog-stereo]
 device-strings = front:%f hw:%f
 channel-map = left,right
-paths-output = analog-output analog-output-speaker 
analog-output-desktop-speaker analog-output-headphones 
analog-output-headphones-2 analog-output-mono
+paths-output = analog-output analog-output-speaker 
analog-output-desktop-speaker analog-output-headphones 
analog-output-headphones-2
 paths-input = analog-input-front-mic analog-input-rear-mic 
analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic 
analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner 
analog-input-fm analog-input-mic-line analog-input-headphone-mic 
analog-input-headset-mic
 priority = 10
 
diff --git a/src/modules/alsa/mixer/profile-sets/extra-hdmi.conf 
b/src/modules/alsa/mixer/profile-sets/extra-hdmi.conf
index aaf4d91..098de03 100644
--- a/src/modules/alsa/mixer/profile-sets/extra-hdmi.conf
+++ b/src/modules/alsa/mixer/profile-sets/extra-hdmi.conf
@@ -34,7 +34,7 @@ priority = 1
 [Mapping analog-stereo]
 device-strings = front:%f hw:%f
 channel-map = left,right
-paths-output = analog-output analog-output-speaker 
analog-output-desktop-speaker analog-output-headphones 
analog-output-headphones-2 analog-output-mono
+paths-output = analog-output analog-output-speaker 
analog-output-desktop-speaker analog-output-headphones 
analog-output-headphones-2
 paths-input = analog-input-front-mic analog-input-rear-mic 
analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic 
analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner 
analog-input-fm analog-input-mic-line analog-input-headphone-mic 
analog-input-headset-mic
 priority = 10
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-05-01 Thread Tanu Kaskinen
 src/modules/bluetooth/bluetooth-util.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b4e2c503eb26b10662e5803fd213c14ebea29843
Author: Tanu Kaskinen 
Date:   Wed May 1 13:39:36 2013 +0300

bluetooth: Fix error checking style

diff --git a/src/modules/bluetooth/bluetooth-util.c 
b/src/modules/bluetooth/bluetooth-util.c
index cee283e..8b9c1ba 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -910,7 +910,7 @@ static int parse_device_properties(pa_bluetooth_device *d, 
DBusMessageIter *i, b
 
 dbus_message_iter_recurse(&element_i, &dict_i);
 
-if (parse_device_property(d, &dict_i, is_property_change))
+if (parse_device_property(d, &dict_i, is_property_change) < 0)
 ret = -1;
 
 dbus_message_iter_next(&element_i);

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-04-29 Thread David Henningsson
 src/modules/module-switch-on-port-available.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 093c30ec12c73cb0bef1869a3710ef564f228bd9
Author: poljar (Damir Jelić) 
Date:   Fri Apr 19 16:35:14 2013 +0200

switch-on-port-available: Silence gcc warning.

This silences this gcc warning:
module-switch-on-port-available.c:111:12: warning:
'good' may be used uninitialized in this function

diff --git a/src/modules/module-switch-on-port-available.c 
b/src/modules/module-switch-on-port-available.c
index 819835d..35cecea 100644
--- a/src/modules/module-switch-on-port-available.c
+++ b/src/modules/module-switch-on-port-available.c
@@ -94,7 +94,7 @@ static int try_to_switch_profile(pa_device_port *port) {
 pa_log_debug("Finding best profile");
 
 PA_HASHMAP_FOREACH(profile, port->profiles, state) {
-bool good;
+bool good = false;
 
 if (best_profile && best_profile->priority >= profile->priority)
 continue;

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-04-16 Thread David Henningsson
 src/modules/alsa/alsa-mixer.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 88405ee69e4adb7d8ef5708366087f7fd5b65625
Author: David Henningsson 
Date:   Tue Apr 16 14:44:05 2013 +0200

alsa-mixer: Change profile-sets directory to PA_SRCDIR

A recent patch changed the path files from PA_BUILDDIR to PA_SRCDIR.
Do the same to the profile-set files for consistency (and to fix
out of tree builds).

Signed-off-by: David Henningsson 

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 9a428f4..be9ee4e 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -4185,7 +4185,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char 
*fname, const pa_channel
 fname = "default.conf";
 
 fn = pa_maybe_prefix_path(fname,
-  pa_run_from_build_tree() ? PA_BUILDDIR 
"/modules/alsa/mixer/profile-sets/" :
+  pa_run_from_build_tree() ? PA_SRCDIR 
"/modules/alsa/mixer/profile-sets/" :
   PA_ALSA_PROFILE_SETS_DIR);
 
 r = pa_config_parse(fn, NULL, items, NULL, ps);

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-04-13 Thread Arun Raghavan
 src/modules/alsa/mixer/paths/analog-input-headset-mic.conf |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 6140191f2701609bccb31cca58e3b9599a1d
Author: David Henningsson 
Date:   Fri Apr 12 11:56:17 2013 +0200

alsa-mixer: Add more jack detection for Headset mic path

On some machines which has a headset jack, the headset mic does not have 
its own
jack detection. Then we can look at the headphone jack to get some 
indication:
We know that if the headphone is unplugged, so is the headset mic. The 
opposite
is not guaranteed since the user might have plugged in a headphone, not a 
headset.

Also, there exist multi-function jacks which support both Headphone, Mic in 
headphone jack
and Headset Mic. In this case the jack name will be "Headphone Mic", not 
"Headphone", so
we need to include this name too.

Signed-off-by: David Henningsson 

diff --git a/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf 
b/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf
index 6be2c95..0a3d661 100644
--- a/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf
@@ -30,6 +30,12 @@ state.plugged = unknown
 state.unplugged = unknown
 required-any = any
 
+[Jack Headphone]
+state.plugged = unknown
+
+[Jack Headphone Mic]
+state.plugged = unknown
+
 [Element Headset Mic Boost]
 required-any = any
 switch = select

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-04-04 Thread David Henningsson
 src/modules/alsa/mixer/paths/analog-input-headset-mic.conf |7 +++
 src/modules/alsa/mixer/paths/analog-output-headphones.conf |7 +++
 2 files changed, 14 insertions(+)

New commits:
commit 6eecb2f3f3cca6286b3f85751b2a74a227394836
Author: David Henningsson 
Date:   Mon Mar 25 14:56:05 2013 +0100

alsa-mixer: Add "Headset Playback|Capture" element

Found on Logitech B530 USB Headset / kernel 3.8. Because we don't
have different path for headset and headphone today, just add
Headset to the existing headphone path.

BugLink: https://bugs.launchpad.net/bugs/1159687
Signed-off-by: David Henningsson 

diff --git a/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf 
b/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf
index 0310ccb..6be2c95 100644
--- a/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf
@@ -44,6 +44,13 @@ volume = merge
 override-map.1 = all
 override-map.2 = all-left,all-right
 
+[Element Headset]
+required-any = any
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
 [Element Capture]
 switch = mute
 volume = merge
diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones.conf 
b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
index 4266d11..e876768 100644
--- a/src/modules/alsa/mixer/paths/analog-output-headphones.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
@@ -69,6 +69,13 @@ volume = merge
 override-map.1 = all
 override-map.2 = all-left,all-right
 
+[Element Headset]
+required-any = any
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
 [Element Line HP Swap]
 switch = on
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits


[pulseaudio-commits] Branch 'next' - src/modules

2013-03-29 Thread Tanu Kaskinen
 src/modules/alsa/alsa-ucm.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 57d859d3873f8f6bded1a64d2f49b9e072dc992d
Author: Tanu Kaskinen 
Date:   Fri Mar 29 17:17:14 2013 +0200

alsa: Don't use pa_strna() for port names

The name variable is never NULL, so there's no point in using
pa_strna().

diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index d8ff621..3b55e82 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -691,7 +691,7 @@ static void ucm_add_port_combination(
 pa_device_port_new_data port_data;
 
 pa_device_port_new_data_init(&port_data);
-pa_device_port_new_data_set_name(&port_data, pa_strna(name));
+pa_device_port_new_data_set_name(&port_data, name);
 pa_device_port_new_data_set_description(&port_data, desc);
 pa_device_port_new_data_set_direction(&port_data, is_sink ? 
PA_DIRECTION_OUTPUT : PA_DIRECTION_INPUT);
 

___
pulseaudio-commits mailing list
pulseaudio-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits