<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:SimSun;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:SimSun;}
.MsoChpDefault
        {mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>
<div class=WordSection1>
<p class=MsoNormal><span lang=EN-US>I’m working on a module that can
switch profile for a Bluetooth headset: A2DP for music playback and HSP for a
phone.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>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:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>>>list-sinks<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>index: 2<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> name:
<bluez_sink.00_16_44_FD_36_33.2><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> driver:
<module-bluetooth-device.c><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> flags:
HARDWARE HW_VOLUME_CTRL LATENCY <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> state:
RUNNING<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> …<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> current
latency: 128.46 ms<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> sample
spec: s16le 1ch 8000Hz<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> channel
map: mono<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> …<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> fixed
latency: 128.00 ms <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>>>list-sink-inputs<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>index: 3<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> driver:
<protocol-native.c><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> flags:
START_CORKED <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> state:
RUNNING<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> sink:
2 <bluez_sink.00_16_44_FD_36_33.2> <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> current
latency: 0.00 ms … this is abnormal. How PA
calculate this value?<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> requested
latency: 128.00 ms<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> sample
spec: s16le 1ch 8000Hz<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> channel
map: mono<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> resample
method: (null)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> client:
7 <Empathy> … This is the frontend application of GTalk<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>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?<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>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:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>“current latency: 1982.00 ms, requested
latency: 128.00 ms”.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Greate thanks<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Amanda<o:p></o:p></span></p>
</div>
</body>
</html>