Re: [pulseaudio-discuss] [PATCH 5/6] alsa: create ucm profiles

2011-04-07 Thread Margarita Olaya
Hi David,

On Wed, Apr 6, 2011 at 1:41 AM, David Henningsson
david.hennings...@canonical.com wrote:
 On 2011-04-05 22:34, Margarita Olaya wrote:

 +static pa_hook_result_t jack_insert_new_hook_callback(pa_core *c,
 struct userdata *u) {
 +    struct pa_alsa_ucm_config *ucm =u-ucm;
 +    struct profile_data *d;
 +    char *device_name;
 +
 +    pa_assert(u);
 +
 +    d = PA_CARD_PROFILE_DATA(u-card-active_profile);
 +
 +    pa_log_debug(Jack insert new hook callback);
 +
 +    device_name = strchr(d-profile-name, ':') + 2;
 +    if (!device_name) {
 +        pa_log(no device found for %s, d-profile-name);
 +        return PA_HOOK_CANCEL;
 +    }
 +
 +    if (strcmp(device_name, Headset.0) == 0)
 +        return PA_HOOK_OK;
 +
 +    /* Set headset.0 device per default */
 +    if (snd_use_case_set(ucm-ucm_mgr, _enadev, Headset.0)  0) {
 +        pa_log(failed to set device Headset.0);
 +        return PA_HOOK_CANCEL;
 +    }
 +
 +    return PA_HOOK_OK;
 +}

 About this function:

 1) pa_hook_cb_t defines three pointers as input, but this one only takes
 two. Is that really working on all platforms?

This is a mistake in this version, It is fixed now.

 2) There is no matching against what card sent the event, is that irrelevant
 for UCM?

The UCM data is store per sound, I'm looking into a way of passing the
card name to the hook and compare it with the one passed in the
userdata.

 3) Is Headset.0 a reserved identifier in UCM, or is this unfinished test
 code? What if there isn't a headset, just a separate external mic, or
 external speakers connected to line out?

It depends on the driver to report here what was inserted or removed.

 +
 +static pa_hook_result_t jack_remove_new_hook_callback(pa_core *c,
 struct userdata *u) {
 +    struct profile_data *d;
 +    struct pa_alsa_ucm_config *ucm =u-ucm;
 +    char *device_name;
 +
 +    pa_assert(u);
 +
 +    d = PA_CARD_PROFILE_DATA(u-card-active_profile);
 +
 +    pa_log_debug(Jack removed new hook callback);
 +
 +    device_name = strchr(d-profile-name, ':') + 2;
 +    if(!device_name) {
 +        pa_log(no device found for %s, d-profile-name);
 +        return PA_HOOK_CANCEL;
 +    }
 +
 +    /* Set current profile device */
 +    if (snd_use_case_set(ucm-ucm_mgr, _enadev, Headset.0)  0) {
 +        pa_log(failed to set device Headset.0);
 +        return PA_HOOK_CANCEL;
 +    }
 +
 +    return PA_HOOK_OK;
 +}

 Ehm, seems like you set it to the Headset device both on plug and unplug...?

hmm, here we will switch to device_name gotten from the current
profile, in case of failure the device will be disabled.

I will post the changes soon.

Regards,
Margarita

 --
 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

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] intermittent audio

2011-04-07 Thread pl bossart
 I'm not sure if this is the right venue, but I'm not sure where else to ask.  
 If there's a more appropriate place, please let me know.

 I recently upgraded my MythTV server from Fedora 11 to Fedora 14.  Now the 
 only way to get sound to work is to follow these steps:

 Start the audio source so that there's an audio stream
 Open the Pulseaudio Volume Control panel
 Click the Configuration tab,
 Change Internal Audio to any profile other than the current one
 Change Internal Audio back to the original profile ( Digital Stereo Duplex 
 (IEC958) )

 At this point, the audio works.  But if I change from watching one show in 
 MythTV to another, I have to go through the whole process again.  It's like 
 as soon as pulseaudio loses a signal, it has to be reset.  The issue is odd 
 enough that I don't even know what keywords to search for to see if this is a 
 common problem - has anyone heard of this?  Does anyone have any suggestions 
 for how to fix or troubleshoot it?


rm -rf ~/.pulse*
pulseaudio -vvv 2 log.txt
pastebin log.txt and send us the link
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] LAC2011: Linux Audio Conference - Are you going?

2011-04-07 Thread Colin Guthrie
'Twas brillig, and David Henningsson at 07/04/11 12:52 did gyre and gimble:
 On 2011-04-06 23:46, Kurt Taylor wrote:
 It looks like I might be able to go to LAC. I can see about scheduling a
 PulseAudio workgroup time and space with the LAC folks or nearby.
 
 If so, you should coordinate with Colin Guthrie (coling on IRC).
 
 So, I need a headcount ASAP, are you going?
 
 I'll be going, I'll arrive Thursday evening and leave Sunday afternoon.

Ditto on the timings.

Lennart is also going but not yet sure of his schedule.

 Would you be interested in
 a PulseAudio meetup and working session?
 
 Yes.
 
 If so, what agenda items?
 
 Everything :-) Continuation on what and when for master/PA 1.0.


Pretty much what David said :)

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] LAC2011: Linux Audio Conference - Are you going?

2011-04-07 Thread Daniel Mack
On Thu, Apr 7, 2011 at 5:18 PM, Colin Guthrie gm...@colin.guthr.ie wrote:
 'Twas brillig, and David Henningsson at 07/04/11 12:52 did gyre and gimble:
 On 2011-04-06 23:46, Kurt Taylor wrote:
 It looks like I might be able to go to LAC. I can see about scheduling a
 PulseAudio workgroup time and space with the LAC folks or nearby.

 If so, you should coordinate with Colin Guthrie (coling on IRC).

 So, I need a headcount ASAP, are you going?

 I'll be going, I'll arrive Thursday evening and leave Sunday afternoon.

 Ditto on the timings.

 Lennart is also going but not yet sure of his schedule.

 Would you be interested in
 a PulseAudio meetup and working session?

 Yes.

 If so, what agenda items?

 Everything :-) Continuation on what and when for master/PA 1.0.

FWIW, I'll be there, giving a talk about PulseAudio on Mac OS X.

Daniel
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] pa_simple_free

2011-04-07 Thread patrick

more informations about our problem:

in thread-mainloop.c

void pa_threaded_mainloop_stop(pa_threaded_mainloop *m) {
...
// freeze here:
pa_mutex_lock(m-mutex);
...
}

what would be the cause? it stop at pa_mutex_lock(m-mutex). what can i 
do to fix this problem? any advice is more than welcome.


pat
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] pa_simple_free

2011-04-07 Thread Daniel Mack
On Thu, Apr 7, 2011 at 7:15 PM, patrick pured...@11h11.com wrote:
 more informations about our problem:

 in thread-mainloop.c

 void pa_threaded_mainloop_stop(pa_threaded_mainloop *m) {
 ...
 // freeze here:
 pa_mutex_lock(m-mutex);
 ...
 }

 what would be the cause? it stop at pa_mutex_lock(m-mutex). what can i do
 to fix this problem? any advice is more than welcome.

Are your calling pa_threaded_mainloop_stop() while the mainloop is
locked? IOW, did you call pa_threaded_mainloop_lock() without
pa_threaded_mainloop_unlock() before?

Quoting the documentation:

 void pa_threaded_mainloop_stop(   pa_threaded_mainloop *  
 m )
 Terminate the event loop thread cleanly.
 Make sure to unlock the mainloop object before calling this function.

Daniel
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] pa_simple_free

2011-04-07 Thread patrick



Does the parec-simple example work for you (it's part of the
PulseAudio source tree).



Hi Daniel,

For first of all thank you for taking the time to help me track down our 
problem. parec-simple is working (nicely quitting). So the problem must 
be in this small code: http://pastebin.ubuntu.com/590602/


the thing is, all the other audio driver (portaudio, alsa, oss, esd) are 
working fine with the same code. but pulseaudio stop at 
pa_mutex_lock(m-mutex); does it means that 2 thread are conflicting. 
like you can read, i am not a good coder at all, i don't understand the 
reason of pa_mutex_lock. do you think that switching to the full API 
might help? is it possible to use the same kind of code / call (our 
audio read function is call, read the recording source and return the 
buffer size.


pat

Daniel




___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] pa_simple_free

2011-04-07 Thread Arun Raghavan
Hi,

On Fri, 2011-04-08 at 03:15 +0900, patrick wrote:
  Does the parec-simple example work for you (it's part of the
  PulseAudio source tree).
 
 
 Hi Daniel,
 
 For first of all thank you for taking the time to help me track down our 
 problem. parec-simple is working (nicely quitting). So the problem must 
 be in this small code: http://pastebin.ubuntu.com/590602/

I modified your code to compile independently and it works fine here.
http://paste.pocoo.org/show/367406/

Are you using the API differently from this in your code?

-- Arun

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] 2 minor issues noticed with padsp

2011-04-07 Thread Drew Ogle
Hi,

I have a really old application that uses oss interfaces, and noticed that
when attempting to run via padsp it would fail ( as opposed to with aoss ).
After talking with Ford_Prefect in #pulseaudio, we narrowed down the problem
to protocol-native.c
Attached is a patch which allows padsp's get_sink_info call to success on
the server side ( drop-invalid-check ).
He mentioned that name is allowed to be null; which makes me think it might
be less confusing to just do a *name check and then no others.

Additionally, I noticed that in padsp.c it was recieving two callbacks in
both sink and source_info_cb. As this appears to be the desired behavior in
introspect.c, I modified the _cb functions to only notify if success was not
already set.

-drew
diff -udPr --exclude=orig pulseaudio-0.9.21/orig/src/pulsecore/protocol-native.c pulseaudio-0.9.21/src/pulsecore/protocol-native.c
--- pulseaudio-0.9.21/orig/src/pulsecore/protocol-native.c	2009-11-22 22:57:07.0 -0500
+++ pulseaudio-0.9.21/src/pulsecore/protocol-native.c	2011-04-07 16:28:09.0 -0400
@@ -3125,7 +3125,6 @@
(command == PA_COMMAND_GET_SOURCE_INFO 
 pa_namereg_is_valid_name_or_wildcard(name, PA_NAMEREG_SOURCE)) ||
pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
-CHECK_VALIDITY(c-pstream, idx != PA_INVALID_INDEX || name, tag, PA_ERR_INVALID);
 CHECK_VALIDITY(c-pstream, idx == PA_INVALID_INDEX || !name, tag, PA_ERR_INVALID);
 CHECK_VALIDITY(c-pstream, !name || idx == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
 
diff -udPr --exclude=orig pulseaudio-0.9.21/orig/src/utils/padsp.c pulseaudio-0.9.21/src/utils/padsp.c
--- pulseaudio-0.9.21/orig/src/utils/padsp.c	2009-09-18 16:21:44.0 -0400
+++ pulseaudio-0.9.21/src/utils/padsp.c	2011-04-07 17:14:26.0 -0400
@@ -1205,8 +1205,8 @@
 fd_info *i = userdata;
 
 if (!si || eol  0) {
-i-operation_success = 0;
-pa_threaded_mainloop_signal(i-mainloop, 0);
+	if( ! i-operation_success )
+   pa_threaded_mainloop_signal(i-mainloop, 0);
 return;
 }
 
@@ -1227,8 +1227,8 @@
 fd_info *i = userdata;
 
 if (!si || eol  0) {
-i-operation_success = 0;
-pa_threaded_mainloop_signal(i-mainloop, 0);
+	if( ! i-operation_success )
+   pa_threaded_mainloop_signal(i-mainloop, 0);
 return;
 }
 
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] intermittent audio

2011-04-07 Thread Colin Guthrie
'Twas brillig, and pl bossart at 07/04/11 15:48 did gyre and gimble:
 I'm not sure if this is the right venue, but I'm not sure where else to ask. 
  If there's a more appropriate place, please let me know.

 I recently upgraded my MythTV server from Fedora 11 to Fedora 14.  Now the 
 only way to get sound to work is to follow these steps:

 Start the audio source so that there's an audio stream
 Open the Pulseaudio Volume Control panel
 Click the Configuration tab,
 Change Internal Audio to any profile other than the current one
 Change Internal Audio back to the original profile ( Digital Stereo Duplex 
 (IEC958) )

 At this point, the audio works.  But if I change from watching one show in 
 MythTV to another, I have to go through the whole process again.  It's like 
 as soon as pulseaudio loses a signal, it has to be reset.  The issue is odd 
 enough that I don't even know what keywords to search for to see if this is 
 a common problem - has anyone heard of this?  Does anyone have any 
 suggestions for how to fix or troubleshoot it?

 
 rm -rf ~/.pulse*
 pulseaudio -vvv 2 log.txt
 pastebin log.txt and send us the link


Also, are you sure MythTV is using PA?

The MythTV guys insist on automatically suspending PA which can cause
deadlocks if you configure MythTV to use the alsa:default ALSA device.
I've tried to explain this on IRC before, but it has never quite stuck.

I'd either configure your MythTV to use the device alsa:pulse
(assuming you have such an alsa definition?) or to use the built in
PulseAudio support.

Or simply ask your local friendly Fedora packager to apply this patch...
(which I still maintain should be applied upstream but I've given up
trying...)

http://svnweb.mageia.org/packages/cauldron/mythtv/current/SOURCES/0101-pulse-Do-not-suspend-PA-when-using-alsa-default.patch?view=markup

HTHs

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] [RFC] Pulseaudio jack sense

2011-04-07 Thread Colin Guthrie
Hiya Maggie,

'Twas brillig, and Margarita Olaya at 11/03/11 16:50 did gyre and gimble:
  The second thing is to figure out what we should really do once we have
  detected jack insertion or removal. Adding a hook event and let other
  modules act on that, seems reasonable to me. But we should also add a
  property to the property list (or something similar?) telling the current
  state of the jack - and btw, can this be figured out by reading from
  /dev/input/eventX at startup?
 
 atm the target is to used it along with the UCM module, so once we
 have detected jack insertion or removal the UCM will configure the
 sound card for it, so  we need a (new?) hook to notify the other
 modules.


Sorry for lack of replies from me of late... been a bit swamped at
$DAYJOB :p

Am I right in saying that you basically have to set appropriate verbs
via UCM when the jack is inserted?


In my mind, jack detection should basically change the sink/source ports
only. Then the UCM module would hook into the fact that the port had
changed to do it's magic (there are existing hooks for this already in
place).

That way jack detection is technically separated from UCM via the
abstraction of sink/source ports in PA.

We discussed a similar logic for setting verbs on IRC.
http://colin.guthr.ie/meetings/pulseaudio-meeting/2011/pulseaudio-meeting.2011-02-24-21.02.log.html#l-146

This may not be entirely possible depending on what you actually need to
do with UCM... but perhaps it will fit in nicely.


I've not looked specifically at the code, but I'd have expected that
jack detection would somehow be built into module-alsa-card or
module-alsa-source/sink rather than shipped as a separate module (tho'
I'm maybe not appreciating some intricacy here)... I'll try and review
the code soon (although others may have beaten me to it anyway :D)

Cheers

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] pulseaudio 0.9.22, after system suspends and resumes, alsasink is blocked

2011-04-07 Thread Baek Chang
Running into a weird issue.  I am doing the following on 0.9.22 version of
pulseaudio

start pulseaudio, and play and audio file.
when the file is done playing, after 5 seconds, the alsa sink suspends.
then I let the system go to power collapse.

When I resume and play an audio file again, alsa sink is blocked somewhere,
I do not see the message
I: alsa-sink.c: Trying resume...
The PA_SINK_SET_STATE message doesn't seem to be called to the alsa sink.

Alsa is not blocked at this point, I can do an aplay to hw:0 and hear the
output, bypassing pulseaudio.


here is an example from pulseaudio with debug messages enabled, after
suspend/resume:

aplay -D media /usr/palm/sounds/phone.wav -vvv 
root@palm-webos:/var/home/root# I: client.c: Created 2 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
Playing WAVE '/usr/palm/sounds/phone.wav' : Signed 16 bit Little Endian,
Rate 44100 Hz, Stereo
D: module-suspend-on-idle.c: Sink pcm_output becomes busy.
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 ALSA Playback on pcm_output with sample
spec s16le 2ch 44100Hz and channel map front-left,front-right
I: sink-input.c: media.name = ALSA Playback
I: sink-input.c: application.name = ALSA plug-in [aplay]
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 = 3593
I: sink-input.c: application.process.user = root
I: sink-input.c: application.process.host = palm-webos
I: sink-input.c: application.process.binary = aplay
I: sink-input.c: application.language = C
I: sink-input.c: application.process.machine_id = palm-webos
I: protocol-native.c: Requested tlength=500.00 ms, minreq=124.99 ms
D: protocol-native.c: Early requests mode enabled, configuring sink latency
to minreq.
D: memblockq.c: memblockq requested: maxlength=4194304, tlength=88200,
base=4, prebuf=66152, minreq=9596 maxrewind=0
D: memblockq.c: memblockq sanitized: maxlength=4194304, tlength=88200,
base=4, prebuf=66152, minreq=9596 maxrewind=0
I: protocol-native.c: Final latency 554.42 ms = 391.20 ms + 2*54.40 ms +
54.42 ms
D: sink-input.c: SetVolumeWithRamping: Virtual Volume From 1646=0.16 to
41160=0.247734
D: sink-input.c: Sink input's soft volume is 41160= 0.247734
D: sink-input.c: Volume Ramping: Point 1 is 1=0.15, Point 2 is
16236=0.247742
I: module-palm-policy.c: parse_message: ramp command received, sink is 4,
volumetoset:70, headphones:0
ALSA - PulseAudio PCM I/O Plugin
Its setup is:
  stream   : PLAYBACK
  access   : RW_INTERLEAVED
  format   : S16_LE
  subformat: STD
  channels : 2
  rate : 44100
  exact rate   : 44100 (44100/1)
  msbits   : 16
  buffer_size  : 22050
  period_size  : 5512
  period_time  : 125000
  tstamp_mode  : NONE
  period_step  : 1
  avail_min: 5512
  period_event : 0
  start_threshold  : 22050
  stop_threshold   : 22050
  silence_threshold: 0
  silence_size : 0
  boundary : 1445068800
Max peak (11024 samples): 0x2dd0  35%
Max peak (11024 samples): 0x332c  39%
Max peak (11024 samples): 0x3741 #43%
D: protocol-native.c: Requesting rewind due to end of underrun.
D: protocol-native.c: Requesting rewind due to end of underrun.
Max peak (11024 samples): 0x353f #41%
D: protocol-native.c: Requesting rewind due to end of underrun.
D: protocol-native.c: Requesting rewind due to end of underrun.

Just waits here forever.  Sink doesnt get resume call, and alsasink doesn't
get resumed either

Any ideas?

-- 
-baeksanchang
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss