Re: [pulseaudio-discuss] rewind and underrun issues on start of playback
Hi baeksan, Accidently I see your post about Pulseaudio rewind issue, that's quite same with mine. The background is, with timer-based feature enabled, i use default 2000ms of tsched_size, when playback begins there's rewind operation because of application's request latency very low,so the final buffer size will be a small value after calculation. then there will be nearly 3 seconds before hear the real sound. Maybe alsa is playing silence data or didnot start to playback operations. From your log i see the buffer_size/period_size is not too big, so do you have try with a big tsched_size value(such as 2 second). if we have same result, that's maybe Pulseaudio's bug about the rewind operations. --xingchao = From baeksan at ccrma.stanford.edu Sun May 1 00:38:34 2011 From: baeksan at ccrma.stanford.edu (Baek Chang) Date: Sat, 30 Apr 2011 15:38:34 -0700 Subject: [pulseaudio-discuss] rewind and underrun issues on start of playback Message-ID: banlktikq1u6duzzikgfqgs0ofm2mkc5...@mail.gmail.com Hi, I'm seeing some issue with underruns/rewinds occurring on the beginning of every sink input playback. I see rewind requests on alsa sink of 9600 bytes. The alsa driver is configured with the following buffer sizes I: sink.c: device.buffering.buffer_size = 9600 I: sink.c: device.buffering.fragment_size = 4800 So it seems like one buffer size is always being rewinded on the beginning of playback. Is there a way to prevent these rewinds/underruns when starting playback? after the stream has started, there is no issue with audio dropouts or underruns, just on the beginning. If i log the data that gets sent to alsa, from pulseaudio or in the alsa driver, i do see the beginning being dropped as well. please see attached logs using both tshed=0 and tsched=1. any help with this? thanks! I: client.c: Created 0 Native client (UNIX socket client) D: protocol-native.c: Protocol version: remote 19, local 19 I: protocol-native.c: Got credentials: uid=0 gid=0 success=1 D: protocol-native.c: SHM possible: yes D: protocol-native.c: Negotiated SHM: no D: memblockq.c: memblockq requested: maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0 D: memblockq.c: memblockq sanitized: maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0 I: sink-input.c: Created input 0 /usr/palm/sounds/notification.wav on pcm_output with sample spec s16le 2ch 44100Hz and channel map front-left,front-right I: sink-input.c: media.format = WAV (Microsoft) I: sink-input.c: media.name = /usr/palm/sounds/notification.wav I: sink-input.c: application.name = pacat I: sink-input.c: native-protocol.peer = UNIX socket client I: sink-input.c: native-protocol.version = 19 I: sink-input.c: application.process.id = 4474 I: sink-input.c: application.process.user = root I: sink-input.c: application.process.host = PalmDevice I: sink-input.c: application.process.binary = pacat I: sink-input.c: application.language = C I: sink-input.c: application.process.machine_id = PalmDevice I: protocol-native.c: Requested tlength=2000.00 ms, minreq=20.00 ms D: protocol-native.c: Traditional mode enabled, modifying sink usec only for compat with minreq. D: memblockq.c: memblockq requested: maxlength=4194304, tlength=352800, base=4, prebuf=349276, minreq=3528 maxrewind=0 D: memblockq.c: memblockq sanitized: maxlength=4194304, tlength=352800, base=4, prebuf=349276, minreq=3528 maxrewind=0 I: protocol-native.c: Final latency 2054.42 ms = 1960.00 ms + 2*20.00 ms + 54.42 ms D: protocol-native.c: Requesting rewind due to end of underrun. D: alsa-sink.c: Requested to rewind 9600 bytes. D: alsa-sink.c: Limited to 9344 bytes. D: alsa-sink.c: before: 2336 D: alsa-sink.c: after: 2336 D: alsa-sink.c: Rewound 9344 bytes. D: sink.c: Processing rewind... D: sink-input.c: Have to rewind 9344 bytes on render memblockq. D: source.c: Processing rewind... D: protocol-native.c: Underrun on '/usr/palm/sounds/notification.wav', 0 bytes in queue. D: alsa-sink.c: Requested to rewind 9600 bytes. D: alsa-sink.c: Limited to 9344 bytes. D: alsa-sink.c: before: 2336 D: alsa-sink.c: after: 2336 D: alsa-sink.c: Rewound 9344 bytes. D: sink.c: Processing rewind... D: source.c: Processing rewind... D: core.c: Hmm, no streams around, trying to vacuum. I: sink-input.c: Freeing input 0 /usr/palm/sounds/notification.wav I: client.c: Freed 0 pacat I: protocol-native.c: Connection died. -- -baeksanchang -- next part -- An HTML attachment was scrubbed... URL: https://tango.0pointer.de/pipermail/pulseaudio-discuss/attachments/20110430/97c1f9a4/attachment-0001.htm -- next part -- root at PalmDevice:/media/internal# pulseaudio - D: core-rtclock.c: Timer slack is set to 50 us. D: core-util.c: setpriority() worked. I: core-util.c: Successfully gained nice level -4. I: main.c: Found user 'pulse' (UID 31) and
Re: [pulseaudio-discuss] ask about the assumption of min volume and max volume got from ALSA
Hi, 'Twas brillig, and xing wang at 26/05/11 04:52 did gyre and gimble: Would you please give some comments about Guanqun's patch? We're working on Pulseaudio and meet some bugs, i think we will run faster with community's help. Absolutely! To be honest tho', I was hoping Tanu or David would give their takes on this patch (which they may still do) as they have a better grasp of the audio control side than I do. One thing I will say is that PA will use the info from alsa in such a way as to provide a consistent dB range further up the stack. We take the alsa-provided 0dB point and mark that as our Base volume this is exposed e.g. in the pavucontrol and gnome-volume-control GUI's This base volume is meant to indicate the cleanest path through the h/w. This might not be super relevant to the specific issue in question, but that's a little background on the dB levels exposed by alsa, but I get the impression the volumes you're talking about are not dB related? Looking at your patch, it seems logical enough (although for internal code, I'd use pa_bool_t + TRUE/FALSE values, but that's just a minor observation), so if Tanu ACKs it, I'd happily merge it. Cheers Col thanks --xingchao 2011/5/25 Lu Guanqun guanqun...@intel.com: Hi, This patch needs a little more love. :) No one cared? On Wed, May 25, 2011 at 02:17:18PM +0800, Lu Guanqun wrote: Hi list, I may not have the background on this issue, but from the code, it seems the code assumes min_volume and max_volume should be non negative. Is this the right assumption we should take? What about some drivers exposes that min_volume is -126 and max_volume is 0? Should we fix the driver or generalize pulseaudio code to tolerate these issues? If we allow min_volume could be less than zero, and how about the below patch in your point of view? Could you have a review of the below patch? If that's OK, I can send a standalone patch for it. From 1f5c8fa0e80d9fe2e3d56133afa8fe9a5dbe6693 Mon Sep 17 00:00:00 2001 From: Lu Guanqun guanqun...@intel.com Date: Wed, 25 May 2011 14:12:52 +0800 Subject: [PATCH] fix the assumption that volume is always positive Add a variable to track whether the actual volume is set or not. Suppose this: min volume: -126max volume: 0 then when user wants to set some constant volume to -10, it would fail. Signed-off-by: Lu Guanqun guanqun...@intel.com --- src/modules/alsa/alsa-mixer.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index 1bd709a..23651b0 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -1123,6 +1123,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { snd_mixer_selem_id_t *sid = NULL; int r = 0; long volume = -1; +int volume_set = 0; pa_assert(m); pa_assert(e); @@ -1136,6 +1137,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { switch (e-volume_use) { case PA_ALSA_VOLUME_OFF: volume = e-min_volume; +volume_set = 1; break; case PA_ALSA_VOLUME_ZERO: @@ -1143,18 +1145,20 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { long dB = 0; volume = decibel_fix_get_step(e-db_fix, dB, +1); +volume_set = 1; } break; case PA_ALSA_VOLUME_CONSTANT: volume = e-constant_volume; +volume_set = 1; break; default: pa_assert_not_reached(); } -if (volume = 0) { +if (volume_set) { if (e-direction == PA_ALSA_DIRECTION_OUTPUT) r = snd_mixer_selem_set_playback_volume_all(me, volume); else -- 1.7.2.3 -- guanqun ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss -- guanqun ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] ask about the assumption of min volume and max volume got from ALSA
Hi Col, On Thu, May 26, 2011 at 04:30:03PM +0800, Colin Guthrie wrote: Hi, 'Twas brillig, and xing wang at 26/05/11 04:52 did gyre and gimble: Would you please give some comments about Guanqun's patch? We're working on Pulseaudio and meet some bugs, i think we will run faster with community's help. Absolutely! To be honest tho', I was hoping Tanu or David would give their takes on this patch (which they may still do) as they have a better grasp of the audio control side than I do. One thing I will say is that PA will use the info from alsa in such a way as to provide a consistent dB range further up the stack. We take the alsa-provided 0dB point and mark that as our Base volume this is exposed e.g. in the pavucontrol and gnome-volume-control GUI's This base volume is meant to indicate the cleanest path through the h/w. This might not be super relevant to the specific issue in question, but that's a little background on the dB levels exposed by alsa, but I get the impression the volumes you're talking about are not dB related? Yes, you're right. The volume here is not related to dB. It's just plain volume number I got from ALSA via this API (snd_mixer_selem_get_playback_volume_range). In some ALSA drivers, I got the min_vol to be less than zero. So when I try to set it to be a constant volume, it fails to do so. Looking at your patch, it seems logical enough (although for internal code, I'd use pa_bool_t + TRUE/FALSE values, but that's just a minor observation), so if Tanu ACKs it, I'd happily merge it. I'll change it to bool and send another separate patch for it. Cheers Col thanks --xingchao 2011/5/25 Lu Guanqun guanqun...@intel.com: Hi, This patch needs a little more love. :) No one cared? On Wed, May 25, 2011 at 02:17:18PM +0800, Lu Guanqun wrote: Hi list, I may not have the background on this issue, but from the code, it seems the code assumes min_volume and max_volume should be non negative. Is this the right assumption we should take? What about some drivers exposes that min_volume is -126 and max_volume is 0? Should we fix the driver or generalize pulseaudio code to tolerate these issues? If we allow min_volume could be less than zero, and how about the below patch in your point of view? Could you have a review of the below patch? If that's OK, I can send a standalone patch for it. From 1f5c8fa0e80d9fe2e3d56133afa8fe9a5dbe6693 Mon Sep 17 00:00:00 2001 From: Lu Guanqun guanqun...@intel.com Date: Wed, 25 May 2011 14:12:52 +0800 Subject: [PATCH] fix the assumption that volume is always positive Add a variable to track whether the actual volume is set or not. Suppose this: min volume: -126max volume: 0 then when user wants to set some constant volume to -10, it would fail. Signed-off-by: Lu Guanqun guanqun...@intel.com --- src/modules/alsa/alsa-mixer.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index 1bd709a..23651b0 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -1123,6 +1123,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { snd_mixer_selem_id_t *sid = NULL; int r = 0; long volume = -1; +int volume_set = 0; pa_assert(m); pa_assert(e); @@ -1136,6 +1137,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { switch (e-volume_use) { case PA_ALSA_VOLUME_OFF: volume = e-min_volume; +volume_set = 1; break; case PA_ALSA_VOLUME_ZERO: @@ -1143,18 +1145,20 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { long dB = 0; volume = decibel_fix_get_step(e-db_fix, dB, +1); +volume_set = 1; } break; case PA_ALSA_VOLUME_CONSTANT: volume = e-constant_volume; +volume_set = 1; break; default: pa_assert_not_reached(); } -if (volume = 0) { +if (volume_set) { if (e-direction == PA_ALSA_DIRECTION_OUTPUT) r = snd_mixer_selem_set_playback_volume_all(me, volume); else -- 1.7.2.3 -- guanqun ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss -- guanqun ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited
[pulseaudio-discuss] [PATCH] fix the assumption that volume is always positive
Add a variable to track whether the actual volume is set or not. Suppose this: min volume: -126max volume: 0 then when user wants to set some constant volume to -10, it would fail. --- src/modules/alsa/alsa-mixer.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index f236da0..03a5312 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -1092,6 +1092,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { snd_mixer_selem_id_t *sid = NULL; int r = 0; long volume = -1; +pa_bool_t volume_set = FALSE; pa_assert(m); pa_assert(e); @@ -1105,6 +1106,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { switch (e-volume_use) { case PA_ALSA_VOLUME_OFF: volume = e-min_volume; +volume_set = TRUE; break; case PA_ALSA_VOLUME_ZERO: @@ -1112,18 +1114,20 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { long dB = 0; volume = decibel_fix_get_step(e-db_fix, dB, +1); +volume_set = TRUE; } break; case PA_ALSA_VOLUME_CONSTANT: volume = e-constant_volume; +volume_set = TRUE; break; default: pa_assert_not_reached(); } -if (volume = 0) { +if (volume_set) { if (e-direction == PA_ALSA_DIRECTION_OUTPUT) r = snd_mixer_selem_set_playback_volume_all(me, volume); else ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] fix the assumption that volume is always positive
'Twas brillig, and Lu Guanqun at 26/05/11 09:49 did gyre and gimble: Add a variable to track whether the actual volume is set or not. Suppose this: min volume: -126max volume: 0 then when user wants to set some constant volume to -10, it would fail. Tanu, are you OK with this patch? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] rewind and underrun issues on start of playback
'Twas brillig, and xing wang at 26/05/11 09:09 did gyre and gimble: I: main.c: This is PulseAudio 0.9.22 Just as a very small aside, David did some work on Fighting Rewinds recently. Just search the stable-queue git log for Fighting rewinds... These may already be included in your build, but if not it's perhaps worth grabbing those patches? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] rewind and underrun issues on start of playback
2011/5/26 Colin Guthrie gm...@colin.guthr.ie: 'Twas brillig, and xing wang at 26/05/11 09:09 did gyre and gimble: I: main.c: This is PulseAudio 0.9.22 Just as a very small aside, David did some work on Fighting Rewinds recently. Just search the stable-queue git log for Fighting rewinds... These may already be included in your build, but if not it's perhaps worth grabbing those patches? Thank you Colin, let me have a try. --xingchao Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] rewind and underrun issues on start of playback
'Twas brillig, and xing wang at 26/05/11 10:42 did gyre and gimble: 2011/5/26 Colin Guthrie gm...@colin.guthr.ie: 'Twas brillig, and xing wang at 26/05/11 09:09 did gyre and gimble: I: main.c: This is PulseAudio 0.9.22 Just as a very small aside, David did some work on Fighting Rewinds recently. Just search the stable-queue git log for Fighting rewinds... These may already be included in your build, but if not it's perhaps worth grabbing those patches? Thank you Colin, let me have a try. Of course it's probably sensible to just run the whole stable-queue branch. That's generally what I do in my distro packages... just apply all stable queue patches on top of the official release. A 0.9.23 release will likely go out soon (if I can nail Lennart down!) based on this branch. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] rewind and underrun issues on start of playback
2011/5/26 Colin Guthrie gm...@colin.guthr.ie: 'Twas brillig, and xing wang at 26/05/11 10:42 did gyre and gimble: 2011/5/26 Colin Guthrie gm...@colin.guthr.ie: 'Twas brillig, and xing wang at 26/05/11 09:09 did gyre and gimble: I: main.c: This is PulseAudio 0.9.22 Just as a very small aside, David did some work on Fighting Rewinds recently. Just search the stable-queue git log for Fighting rewinds... These may already be included in your build, but if not it's perhaps worth grabbing those patches? Thank you Colin, let me have a try. Of course it's probably sensible to just run the whole stable-queue branch. That's generally what I do in my distro packages... just apply all stable queue patches on top of the official release. A 0.9.23 release will likely go out soon (if I can nail Lennart down!) based on this branch. Hi Colin, i think my release had include David's patchset. I see there're three patches about Fast rewind, here's the link: http://gstreamer-devel.966125.n4.nabble.com/Fighting-rewinds-pulseaudio-crash-update-td3248107.html. The delay issue met based on my release build could not be fixed with David's patch. But i think it's quite like Ccrma's description in post rewind and underrun issues on start of playback. If change the buffer size to smaller value, the delay becomes short. I am not sure whether alsa is playing silence data or just didnot start playback. Thanks --xingchao Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 1/2] alsa: add jack detection support
I was asked by Colin to give this a quick review, so... On 2011-05-19 18:44, Jorge Eduardo Candelaria wrote: From: Margarita Olaya Cabreram...@slimlogic.co.uk This patch adds support to module-alsa-card so that we can read jack insertion and removal events using the input device subsystem. i.e. we can detect headphone insertions and removals. This patch adds a new module parameter called jack_id that contains the ID of the jack input device associated with this sound card. If we receive a valid jack_id during module init then we start a reader thread that will read the jack input device and fire a hook on every removal and insertion event. Jack support development was kindly sponsored by Wolfson Microelectronics PLC Signed-off-by: Margarita Olaya Cabreram...@slimlogic.co.uk Signed-off-by: Jorge Eduardo Candelariaj...@slimlogic.co.uk --- src/modules/alsa/alsa-jack.h| 42 src/modules/alsa/module-alsa-card.c | 120 +++ src/pulsecore/core.h|2 + 3 files changed, 164 insertions(+), 0 deletions(-) create mode 100644 src/modules/alsa/alsa-jack.h diff --git a/src/modules/alsa/alsa-jack.h b/src/modules/alsa/alsa-jack.h new file mode 100644 index 000..4fc67c6 --- /dev/null +++ b/src/modules/alsa/alsa-jack.h Along the lines of Tanu, if this is not alsa-specific, let's take this header and move into pulsecore. @@ -0,0 +1,42 @@ +#ifndef foopulsejackdetecthfoo +#define foopulsejackdetecthfoo + +/*** + This file is part of PulseAudio. + + Copyright 2011 Wolfson Microelectronics PLC + Author Margarita Olayam...@slimlogic.co.uk + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#includeinttypes.h + +typedef enum pa_jack_event { +PA_JACK_HEADPHONES, +PA_JACK_HEADSET, I'm a little hesitant to whether we should have one headset or whether that should be emulated by one headphone and one microphone, as that is what a headset is. +PA_JACK_MICROPHONE, +PA_JACK_LINEOUT, add PA_JACK_VIDEOOUT for HDMI/Displayport (which was just added to ALSA). +PA_JACK_UNKNOWN, +PA_JACK_MAX +} pa_jack_event_t; + +typedef struct pa_jack_detect { +pa_jack_event_t event; +char *card; Agree with Tanu about pa_card pointer here. +} pa_jack_detect_t; + +#endif diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index e60aa5e..75202fb 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -29,6 +29,9 @@ #includepulsecore/core-util.h #includepulsecore/modargs.h #includepulsecore/queue.h +#includepulsecore/thread.h + +#includelinux/input.h #includemodules/reserve-wrap.h @@ -39,6 +42,7 @@ #include alsa-util.h #include alsa-sink.h #include alsa-source.h +#include alsa-jack.h #include module-alsa-card-symdef.h PA_MODULE_AUTHOR(Lennart Poettering); @@ -55,6 +59,7 @@ PA_MODULE_USAGE( source_properties=properties for the source namereg_fail=pa_namereg_register() fail parameter value device_id=ALSA card index +jack_id=Jack device index Eh, a card can have more than one jack, and is further rather connected to a port rather than a card, so this (and thus the rest of the implementation) doesn't seem right to me. -- David Henningsson, Canonical Ltd. http://launchpad.net/~diwic ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] fix the assumption that volume is always positive
On Thu, 2011-05-26 at 09:50 +0100, Colin Guthrie wrote: 'Twas brillig, and Lu Guanqun at 26/05/11 09:49 did gyre and gimble: Add a variable to track whether the actual volume is set or not. Suppose this: min volume: -126max volume: 0 then when user wants to set some constant volume to -10, it would fail. Tanu, are you OK with this patch? Maybe, maybe not. I posted a question to alsa-devel: http://mailman.alsa-project.org/pipermail/alsa-devel/2011-May/040213.html If negative steps are allowed, I expect there to be more bugs. -- Tanu ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] How to change profile of bluetooth headset for different applications?
On Mon, 2011-05-23 at 18:18 +0100, Colin Guthrie wrote: How about this: Define a new card property similar in concept to PA_PROP_DEVICE_INTENDED_ROLES (device.intended_roles) called PA_PROP_DEVICE_INTENDED_PROFILE (device.intended_profile). In bluetooth device, when loading a headset that has both HSP and A2DP, populate the device with the following code: if (supports_hsp supports_a2dp) { char *k; k = pa_sprintf_malloc(%s.%s, PA_PROP_DEVICE_INTENDED_PROFILE, music); pa_proplist_sets(card_data.proplist, k, a2dp); pa_xfree(k); k = pa_sprintf_malloc(%s.%s, PA_PROP_DEVICE_INTENDED_PROFILE, video); pa_proplist_sets(card_data.proplist, k, a2dp); pa_xfree(k); k = pa_sprintf_malloc(%s.%s, PA_PROP_DEVICE_INTENDED_PROFILE, phone); pa_proplist_sets(card_data.proplist, k, hsp); pa_xfree(k); } This should result in pacmd list-cards dumping a proplist that includes: device.intended_profile.music = a2dp device.intended_profile.video = a2dp device.intended_profile.phone = hsp Then a separate module (module-intended-profiles?) could take care of listening quite generically for streams landing on sink and do the following logic: if (!si-sink || !si-sink-card) return PA_HOOK_OK; char *role = pa_proplist_gets(si-proplist, PA_PROP_MEDIA_ROLE); if (!role) return PA_HOOK_OK; char *k = pa_sprintf_malloc(%s.%s, PA_PROP_DEVICE_INTENDED_PROFILE, role); pa_card *card = si-sink-card; char *profile = pa_proplist_gets(card-proplist, k); pa_xfree(k); if (!profile) return PA_HOOK_OK; if (!pa_streq(card-active_profile, profile)) { /* Save the current profile for later restoration */ ... if (pa_card_set_profile(card, profile, FALSE) 0) /* Find the sink of this card as the above call will likely have changed it */ sink = pa_idxset_first(card-sinks, NULL); pa_sink_input_move_to(si, sink, FALSE); } This code is then completely generic. I'm not 100% sure how well this will work in practice as there may be some nasty races etc. but I think this general approach could work... Perhaps others (i.e. Tanu :D) have better suggestions? If the priority lists would exist already, the module deciding the routing could examine the stream properties and pick the sink+port with the highest priority that can be made available - if the sink+port isn't immediately available, but can be made available, then the routing module would change the profile and port as needed. But the priority lists are not available. I believe the logic that you propose is otherwise good, except that I don't see how the stream could land on the bluetooth (a2dp) sink automatically on phone calls. module-bluetooth-device tags only hsp sinks with the phone tag, not a2dp sinks, so module-intended-roles can't do the required magic. If the hsp sink doesn't exist because the a2dp profile is selected, I don't think there's currently any logic to route the stream to the bluetooth sink. If, however, by some magic the phone stream would be routed to the a2dp sink, then I think your proposal would work fine. For better suggestions, I don't think I have any. Except that use the policy framework - Lin posted from an intel.com address, so I assume he or she (sorry, I don't know Chinese names) is working on Meego, and I've thought that Meego got the policy framework from Maemo. In Maemo the routing is handled by module-policy-enforcement (which gets the command to enable the bluetooth-hsp routing mode from the policy framework), and it works pretty nicely for this kind of use cases. -- Tanu ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] fix the assumption that volume is always positive
On Thu, 2011-05-26 at 14:08 +0300, Tanu Kaskinen wrote: On Thu, 2011-05-26 at 09:50 +0100, Colin Guthrie wrote: 'Twas brillig, and Lu Guanqun at 26/05/11 09:49 did gyre and gimble: Add a variable to track whether the actual volume is set or not. Suppose this: min volume: -126max volume: 0 then when user wants to set some constant volume to -10, it would fail. Tanu, are you OK with this patch? Maybe, maybe not. I posted a question to alsa-devel: http://mailman.alsa-project.org/pipermail/alsa-devel/2011-May/040213.html If negative steps are allowed, I expect there to be more bugs. I got a confirmation that negative volumes are allowed, so the patch should be fine. Somebody should review the alsa mixer code for other cases of the invalid assumption (I plan to do it in the indefinite future, if nobody else does it). -- Tanu ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PACKAGERS] New dep
2011/5/16 Colin Guthrie gm...@colin.guthr.ie: Hi, I've just pushed Arun's (mostly, Pierre-Louis also had a hand!) passthrough work to master. This carries with it a new dependency: json-c What is the upstream location of that software? Googling for json implementations gives a lot of small libraries, it is not clear which one is needed as the pulse dep. I guess it could be the one at http://oss.metaparadigm.com/json-c/, but that website is out of order for some time now. The .tar file is only locatable through the packaging systems of various Linux distros/BSDs. Needless to say, such an unclear status of a dependency is not really helpfull in packaging PulseAudio. We may yet remove this and write our own parser for the simple subset of JSON formatting we use but there may ultimately be other reasons to keep this longer term. But in the interests of simplicity, I'd certainly not be against any native implementation patches that came along provided they were simple and clean. Please test these changes. I'm sure Arun will post more details and test requests in due course. Col Maarten ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PACKAGERS] New dep
'Twas brillig, and Maarten Bosmans at 26/05/11 15:23 did gyre and gimble: 2011/5/16 Colin Guthrie gm...@colin.guthr.ie: Hi, I've just pushed Arun's (mostly, Pierre-Louis also had a hand!) passthrough work to master. This carries with it a new dependency: json-c What is the upstream location of that software? Googling for json implementations gives a lot of small libraries, it is not clear which one is needed as the pulse dep. I guess it could be the one at http://oss.metaparadigm.com/json-c/, but that website is out of order for some time now. The .tar file is only locatable through the packaging systems of various Linux distros/BSDs. Needless to say, such an unclear status of a dependency is not really helpfull in packaging PulseAudio. I dunno, we already had a package in Mandriva and I just updated it to the latest version from the Fedora package. Arun, do you have more definitive info? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] module-echo-cancel
I'm trying to use the echo cancellation module on my embedded platform but it seems to be taking all the cpu usage and renders audio useless. I'm continually seeing these messages: warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. D: module-echo-cancel.c: diff -269 (43555 - 88163 + 44155) 0 0 9600 184 E: module-echo-cancel.c: Playback after capture (-269), drop sink 84 warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. D: module-echo-cancel.c: diff 475 (42663 - 87687 + 45315) 0 0 9600 184 warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. D: module-echo-cancel.c: diff 168 (39254 - 87687 + 48410) 0 0 9600 191 D: module-echo-cancel.c: diff -411 (38089 - 87687 + 49002) 0 0 9600 185 E: module-echo-cancel.c: Playback after capture (-411), drop sink 112 warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. D: module-echo-cancel.c: diff 1491 (41407 - 87052 + 46961) 0 0 9600 175 E: module-echo-cancel.c: playback too far ahead (1491), drop source 260 warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. D: module-echo-cancel.c: diff -1166 (44921 - 88526 + 42252) 0 0 9600 187 E: module-echo-cancel.c: Playback after capture (-1166), drop sink 244 cpu is at 90-100% at the highest cpu scaling. I was loading the module like so in my .pa conf file: load-module module-echo-cancel source_name=echosource source_master=pcm_input sink_name=echosink sink_master=pcm_output rate=44100 channels=2 Is there a step I am missing, or a link to documentation on how to set up the module properly? Thanks -- -baeksanchang ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] module-echo-cancel
On Thu, 2011-05-26 at 10:07 -0700, Baek Chang wrote: I'm trying to use the echo cancellation module on my embedded platform but it seems to be taking all the cpu usage and renders audio useless. I'm continually seeing these messages: warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. This particular message is surprising. Was there a lot of feedback when you saw this? It's also possible that your clock is drifting a lot and is thus causing the echo canceller to give up. What hardware are you trying this on? D: module-echo-cancel.c: diff -269 (43555 - 88163 + 44155) 0 0 9600 184 E: module-echo-cancel.c: Playback after capture (-269), drop sink 84 warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. D: module-echo-cancel.c: diff 475 (42663 - 87687 + 45315) 0 0 9600 184 warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. D: module-echo-cancel.c: diff 168 (39254 - 87687 + 48410) 0 0 9600 191 D: module-echo-cancel.c: diff -411 (38089 - 87687 + 49002) 0 0 9600 185 E: module-echo-cancel.c: Playback after capture (-411), drop sink 112 warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. D: module-echo-cancel.c: diff 1491 (41407 - 87052 + 46961) 0 0 9600 175 E: module-echo-cancel.c: playback too far ahead (1491), drop source 260 warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. warning: The echo canceller started acting funny and got slapped (reset). It swears it will behave now. D: module-echo-cancel.c: diff -1166 (44921 - 88526 + 42252) 0 0 9600 187 E: module-echo-cancel.c: Playback after capture (-1166), drop sink 244 cpu is at 90-100% at the highest cpu scaling. I was loading the module like so in my .pa conf file: load-module module-echo-cancel source_name=echosource source_master=pcm_input sink_name=echosink sink_master=pcm_output rate=44100 channels=2 Do you really need to work with 44.1 kHz stereo streams? Your voip stack is probably working with 8 or 16 kHz audio and running in single channel mode would probably not make a difference either. It will, however, make a huge difference with respect to your CPU consumption. I pushed some more preprocessing code to module-echo-cancel yesterday, but there's a bit of a bug which I should be pushing a fix for by tomorrow. Once that's done, you can try it out by passing agc=1 / denoise=1 / echo_suppress=1. We're still looking at various potential improvements to get AEC working better, and I'll try to post a status in the coming weeks as things start to improve. You may also want to play with aec_method=adrian, which is an alternate canceller. It seems to learn faster than speex, but leaves a larger echo residue compared to once speex has had sufficient time to learn. Cheers, Arun ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PACKAGERS] New dep
On Thu, 2011-05-26 at 16:23 +0200, Maarten Bosmans wrote: 2011/5/16 Colin Guthrie gm...@colin.guthr.ie: Hi, I've just pushed Arun's (mostly, Pierre-Louis also had a hand!) passthrough work to master. This carries with it a new dependency: json-c What is the upstream location of that software? Googling for json implementations gives a lot of small libraries, it is not clear which one is needed as the pulse dep. Yes, it's unfortunate that it's a buzz word and the library name doesn't generate unique search results. I guess it could be the one at http://oss.metaparadigm.com/json-c/, but that website is out of order for some time now. The .tar file is only locatable through the packaging systems of various Linux distros/BSDs. The website worked fine as of a month ago. I don't know why it's down now. The library serves the purpose we need well (light weight, doesn't invent its own type system, allows you to parse out values individually instead of mandating key-value pairs), and is available on every major distribution ... Needless to say, such an unclear status of a dependency is not really helpfull in packaging PulseAudio. ... so the dependency was not picked arbitrarily and the unclear status you speak of is a recent development. I'll mail the developers and ask them what's happening. -- Arun ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PACKAGERS] New dep
On Fri, 2011-05-27 at 00:22 +0530, Arun Raghavan wrote: [...] you speak of is a recent development. I'll mail the developers and ask them what's happening. Should be up in a day or so. -- Arun ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] fix the assumption that volume is always positive
On Thu, May 26, 2011 at 09:21:45PM +0800, Colin Guthrie wrote: 'Twas brillig, and Tanu Kaskinen at 26/05/11 13:48 did gyre and gimble: On Thu, 2011-05-26 at 14:08 +0300, Tanu Kaskinen wrote: On Thu, 2011-05-26 at 09:50 +0100, Colin Guthrie wrote: 'Twas brillig, and Lu Guanqun at 26/05/11 09:49 did gyre and gimble: Add a variable to track whether the actual volume is set or not. Suppose this: min volume: -126max volume: 0 then when user wants to set some constant volume to -10, it would fail. Tanu, are you OK with this patch? Maybe, maybe not. I posted a question to alsa-devel: http://mailman.alsa-project.org/pipermail/alsa-devel/2011-May/040213.html If negative steps are allowed, I expect there to be more bugs. I got a confirmation that negative volumes are allowed, so the patch should be fine. Somebody should review the alsa mixer code for other cases of the invalid assumption (I plan to do it in the indefinite future, if nobody else does it). OK, sounds good. I will queue it up at my end. Thanks! Judging by Takashi's comments on alsa-devel, in an ideal world the driver would be updated too to avoid the use of the negative steps (which is funky :p), but we still need this fix all the same. I'll push a patch into the mis-behaved alsa driver to fix the negative volume. Thanks Tanu's info as well. Thanks for the patch. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss -- guanqun ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PACKAGERS] New dep
On Fri, May 27, 2011 at 04:52:02AM EST, Arun Raghavan wrote: The website worked fine as of a month ago. I don't know why it's down now. The library serves the purpose we need well (light weight, doesn't invent its own type system, allows you to parse out values individually instead of mandating key-value pairs), and is available on every major distribution ... It is availab ein Ubuntu yes, however its in our universe component of the package archive, universe being unsupported by Canonical. If PulseAudio master was used in future versions of Ubuntu, I would feel comfortable knowing that the json c library being used will reguaruly receive upstrea maintenance, as that in turn makes it easier for Canonical to commit to supporting the package in long term releases. Luke ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss