2011/6/2 xing wang <wangxingchao2011 at gmail.com>: > 2011/6/2 Lin, Mengdong <mengdong.lin at intel.com>: >> I?m working on a module that can switch profile for a Bluetooth headset: >> A2DP for music playback and HSP for a phone. >> >> When this module detects a sink-input-put event of a ?phone? like GTalk and >> Bluetooth is the default sink, it can change BT profile from A2DP to HSP if >> necessary. Then the A2DP sink is deleted, and the phone?s input stream will >> be routed to the new HSP Bluetooth sink. >> >> >> >> My problem is: I cannot hear good voice from the other side of GTalk, I get >> bursts of audio (about 2 seconds) followed by very long bursts of silence. >> >> By using pacmd, I found that Gtalk input stream is connected to the BT HSP >> sink, but GTalk input stream?s latency is ?0?, very strange. Like this: >> >> > Mengdong, current latency of the sink-input is calculated by > pa_sink_input_get_latency(), you can check details there. For the "0" > result, there're two "if" conditions in > pa_sink_get_latency_within_thread(). If the sink's state is > "suspended"(from your log,it's running" or sink doesnot support > "PA_SINK_LATENCY", the current latency will be 0. otherwise, there's a > real calculation function in sink_get_latency() in alsa-sink.c.let's > further check the conditions. > > Hi mengdong, pls ignore above wrong explanation. Colin's answer about the latency is right. what i said is sink's latency, not sink-input. Cool work, Colin! thanks --xingchao