[pulseaudio-discuss] How to check audio sample data to a bluetooth sink?

2011-05-27 Thread Lin, Mengdong
Could anybody tell me how dump the data to a Bluetooth sink from a VOIP sink 
input stream? Which function shall I hack?

I try to run GTalk with Bluetooth headset. I set the card profile to HSP. And 
the input stream/output stream are connected to the Bluetooth sink/source.
But I cannot hear the voice from the other side. Increasing the volume of sink 
or sink input does not work. In fact, I tried a very large number but the VOIP 
stream keeps quite in my BT headset.
If I launch a music player at the same time and also move the stream to the 
Bluetooth sink (HSP), I can hear the song. It means the BT sink is working.
If I disconnect Bluetooth handset and switch to speaker, I can here weak voice 
from GTalk. Does the data become invalid when it's connected to BT sink?

So I want to check the input data from GTalk to the Bluetooth sink, to see 
whether the data is bad or just too weak for the BT headset.


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


Re: [pulseaudio-discuss] How to check audio sample data to a bluetooth sink?

2011-05-27 Thread Lin, Mengdong
struct pa_memblock
{
pa_atomic_ptr_t data;   --- is this the valid data buffer pointer?
size_t length; - is this the data length?
...
}

If yes, I can trace the function hsp_process_render of modle-bluetooth-device:
l = pa_write(u-stream_fd, p, u-write_memchunk.length, u-stream_write_type);

I think the memchunk,  contains the data:
typedef struct pa_memchunk {
pa_memblock *memblock; -- real data here?
size_t index, length;
} pa_memchunk;


Thanks
Amanda
___
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?

2011-05-24 Thread Lin, Mengdong
The idea of intended profile is awesome! Great thanks for sharing, Col!  I'll 
try to implement the pseudo module as you suggested. 

I have a quick question: 
 Then a separate module (module-intended-profiles?) could take care of
 listening quite generically for streams landing on sink and do the
 following logic ...

Which event shall I hook for stream landing on sink, is it 
PA_CORE_HOOK_SINK_INPUT_PUT?

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


[pulseaudio-discuss] How to change profile of bluetooth headset for different applications?

2011-05-23 Thread Lin, Mengdong
Is it possible to handle bluetooth profile change within 
module-bluetooth-device, instead of unload this module and reloading it with 
the new profile argument for the same device?

I need my bluetooth headset working under A2DP profile for a music/video 
application and switch to HSP profile automatically for a incoming phone 
application. I wonder if the module-bluetooth-device can monitor application 
change by hooking sink input's put and unlink event, change profile 
accordingly, and create/delete sink or source by itself. Then 
module-switch-on-connect can handle sink/source switch and 
module-cork-music-on-phone can handle music interrupted by a incoming call :)

My current solution is to monitor application change in 
module-bluetooth-discover: when a phone's input stream is put and current 
profile is not HSP, the discover module will unload module-bluetooth-device 
and reload it to HSP profile. I wonder if the bluetooth device module can 
handle this by itself so unloading and reloading can be saved.

I have another question, I learned that the internal concept of a single 
default device can be replaced by priority lists of devices in future routing 
(from Colin's blog: http://colin.guthr.ie/2010/02/this-is-the-route-to-hell/)
Can the logic of module-switch-on-connect conflict with the new routing 
design?
If yes, this means a latest connected Bluetooth headset may not be the default 
device for a phone call and changing the profile is not needed. How can the 
Bluetooth device module know whether it's the default device for an application 
when this application's input stream is PUT?

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


Re: [pulseaudio-discuss] How to find the latest created bluetooth sink/source via event hook?

2011-05-18 Thread Lin, Mengdong
Great thanks for your advice, Col!

 Please note that there already exists a module called
 module-switch-on-connect which does this task, but for all new sinks,
 not just BT sinks.  ...

I found module-switch-on-connect.c is not in 0.9.22 tar ball but in git. When 
will this module be released? 
My work is still based on 0.9.22 and need upgrade to use this module.

 Just so you know, I will am intending on shaking up the routing system
 in PA after v1 is released which will hopefully make this kind of thing
 easier to implement and manage. ...  but essentially the routing will be 
 based on priority lists of
 devices rather than just setting a single device to use.

It sounds great! Could you share more information on this new design, maybe in 
a new thread? 

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


[pulseaudio-discuss] How to find the latest created bluetooth sink/source via event hook?

2011-05-17 Thread Lin, Mengdong
I'm developing an routing module to automatically set a new created Bluetooth 
sink as the default sink when a Bluetooth headset is connected.
So I need to get the new BT sink when it's created.

But when I hook event  PA_CORE_HOOK_SINK_NEW, I found that the sink pointer 
for the callback function is *not* the real sink pointer value.
So although in the hook of PA_CORE_HOOK_SINK_STATE_CHANGED, I can get the 
proper sink pointer, it's not straightforward to know whether an IDLE sink is a 
new created one.

So could anyone share some hint on how to find the new created sink/source? 
Shall I iterate the core's sink/source list and compare pointers in sink/source 
state change callback function?

Thanks
Amanda

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


[pulseaudio-discuss] Are _ref and _unref not necessarily called in pairs?

2011-05-12 Thread Lin, Mengdong
For example, in file module-suspend-on-idle.c , why does the slot function 
sink_input_state_changed_hook_cb only reference the sink input but never 
unreference it?
So the reference count of the sink input will only increase? Does it matter?

Here is the code:
static pa_hook_result_t sink_input_state_changed_hook_cb(pa_core *c, 
pa_sink_input *s, struct userdata *u) {
struct device_info *d;
pa_sink_input_state_t state;

pa_assert(c);
pa_sink_input_assert_ref(s);  ... the sink input is referenced here. But 
where pa_sink_input_unref(s) is called?
pa_assert(u);

state = pa_sink_input_get_state(s);
if (state == PA_SINK_INPUT_RUNNING || state == PA_SINK_INPUT_DRAINED)
if ((d = pa_hashmap_get(u-device_infos, s-sink)))
resume(d);

return PA_HOOK_OK;
}


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


Re: [pulseaudio-discuss] Are _ref and _unref not necessarily called in pairs?

2011-05-12 Thread Lin, Mengdong
Thanks for your clarification, Col!

 -Original Message-
 From: pulseaudio-discuss-boun...@mail.0pointer.de
 [mailto:pulseaudio-discuss-boun...@mail.0pointer.de] On Behalf Of Colin
 Guthrie
 Sent: Thursday, May 12, 2011 5:06 PM
 To: pulseaudio-discuss@mail.0pointer.de
 Subject: Re: [pulseaudio-discuss] Are _ref and _unref not necessarily
 called in pairs?
 
 Hiya,
 
 
 As per the subject question... Yes, they are supposed to be called in
 pairs... BUT
 
 'Twas brillig, and Lin, Mengdong at 12/05/11 09:31 did gyre and gimble:
  For example, in file “module-suspend-on-idle.c “, why does the slot
  function “sink_input_state_changed_hook_cb” only reference the sink
  input but never unreference it?
 
  So the reference count of the sink input will only increase? Does it matter?
 
  Here is the code:
 
  static pa_hook_result_t sink_input_state_changed_hook_cb(pa_core *c,
  pa_sink_input *s, struct userdata *u) {
 
  struct device_info *d;
 
  pa_sink_input_state_t state;
 
 
 
  pa_assert(c);
 
  pa_sink_input_assert_ref(s);  … the sink input is referenced here.
  But where pa_sink_input_unref(s) is called?
 
 
 
 This is not the same as pa_sink_input_ref(). Note the word assert in
 the function call in the code above (it's actually a define, not a
 function but I won't split hairs with myself :D).
 
 Here all that is happening is ensuring that the sink_input object is
 referenced...
 
 The code is in pulsecore/object.h
 
 See lines 91, and 69.
 
 The code basically means assert if the object is not referenced. This is
 a safefy thing to ensure good programming of modules etc.
 
 Hope that clarifies things.
 
 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


[pulseaudio-discuss] How pulseaudio support autospawn?

2011-05-10 Thread Lin, Mengdong
How pulseaudio support autospawn?
After pulse audio daemon is killed manually, how it will be executed 
automatically?  How can it know some client is attempts to connect to it? Could 
someone introduce its internal implementation?

I got a explanation of autospawn:  if the daemon is not running when the first 
client attempts to connect, it will be executed automatically
(From 
http://www.linux-archive.org/ubuntu-development/246411-notable-changes-jauntys-pulseaudio.html)
 But I hope someone can give more detail.

Great Thanks!
Amanda



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