[pulseaudio-discuss] Why does a VOIP sink input's current latency become "0" after moving to a new sink? I saw endless "rewind" in log

Lin, Mengdong mengdong.lin at intel.com
Thu Jun 2 01:58:04 PDT 2011


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:

>>list-sinks
index: 2
         name: <bluez_sink.00_16_44_FD_36_33.2>
         driver: <module-bluetooth-device.c>
         flags: HARDWARE HW_VOLUME_CTRL LATENCY
         state: RUNNING
         ...
         current latency: 128.46 ms
         sample spec: s16le 1ch 8000Hz
         channel map: mono
         ...
         fixed latency: 128.00 ms


>>list-sink-inputs
index: 3
         driver: <protocol-native.c>
         flags: START_CORKED
         state: RUNNING
         sink: 2 <bluez_sink.00_16_44_FD_36_33.2>
         current latency: 0.00 ms     ...  this is abnormal. How PA calculate this value?
         requested latency: 128.00 ms
         sample spec: s16le 1ch 8000Hz
         channel map: mono
         resample method: (null)
         client: 7 <Empathy>   ... This is the frontend application of GTalk


And in PA log, I saw many "protocol-native.c: Requesting rewind due to rewrite".  I think this means GTalk data flow is abnormal and data is lost. Could anyone give me some hint? How the latency is calculated for a sink input? And how can the application be affected?

I think the BT HSP sink is working well, because if I connect another 8KHZ mono music stream to this sink at the same time, I can hear the music. And that music input's latency is non-zero:
"current latency: 1982.00 ms, requested latency: 128.00 ms".


Greate thanks
Amanda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110602/17031dd8/attachment-0001.htm>


More information about the pulseaudio-discuss mailing list