<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 16.08.2015 15:20, Eytan Naim wrote:<br>
    </div>
    <blockquote
      cite="mid:ed932d3db6f74b3cbe82dd6b44f92c23@IL-EXCH02.marvell.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Times New Roman \, serif";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
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;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:520507054;
        mso-list-type:hybrid;
        mso-list-template-ids:1505550968 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></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]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D">So, you managed
            to connect your phone right? Because as I said my PulseAudio
            completely freezes when trying to load bluez5-device-module.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Thanks.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
                pulseaudio-discuss
                [<a class="moz-txt-link-freetext" href="mailto:pulseaudio-discuss-bounces@lists.freedesktop.org">mailto:pulseaudio-discuss-bounces@lists.freedesktop.org</a>]
                <b>On Behalf Of </b>Georg Chini<br>
                <b>Sent:</b> Sunday, August 16, 2015 4:07 PM<br>
                <b>To:</b> General PulseAudio Discussion<br>
                <b>Subject:</b> Re: [pulseaudio-discuss] pulseaudio a2dp
                disconnect problem<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal">On 16.08.2015 13:40, Georg Chini wrote:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <p class="MsoNormal">On 16.08.2015 13:26, Eytan Naim wrote:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman , serif","serif"">Hi Georg,</span><o:p></o:p></p>
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman , serif","serif"">It is asymmetric
                and I will explain.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman , serif","serif"">When a2dp
                connection is established, loopback_module is loaded-
                And that is before streaming has started, so streaming
                is in IDLE state.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman , serif","serif"">Later, when
                remote device pauses the streaming for small interval,
                it keeps the connection up, and I would expect
                PulseAudio state machine would go back to an IDLE state-
                without removal of loppback_module.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman , serif","serif""> </span><o:p></o:p></p>
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman , serif","serif"">Thanks.</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
            <div>
              <div style="border:none;border-top:solid #B5C4DF
                1.0pt;padding:3.0pt 0in 0in 0in">
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
                    pulseaudio-discuss [<a moz-do-not-send="true"
                      href="mailto:pulseaudio-discuss-bounces@lists.freedesktop.org">mailto:pulseaudio-discuss-bounces@lists.freedesktop.org</a>]
                    <b>On Behalf Of </b>Georg Chini<br>
                    <b>Sent:</b> Sunday, August 16, 2015 2:02 PM<br>
                    <b>To:</b> General PulseAudio Discussion<br>
                    <b>Subject:</b> Re: [pulseaudio-discuss] pulseaudio
                    a2dp disconnect problem</span><o:p></o:p></p>
              </div>
            </div>
            <p class="MsoNormal"> <o:p></o:p></p>
            <div>
              <p class="MsoNormal">On 16.08.2015 12:26, Eytan Naim
                wrote:<o:p></o:p></p>
            </div>
            <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
              <p class="MsoPlainText">Hi Tanu,<o:p></o:p></p>
              <p class="MsoPlainText">Thanks for your advice and
                cooperation.<o:p></o:p></p>
              <p class="MsoPlainText">As a result of the loopback_module
                asymmetric oddity, I compared "pacmd list" output
                command between two states (you can see attached files):<o:p></o:p></p>
              <p class="MsoPlainText"
                style="margin-left:.5in;text-indent:-.25in;mso-list:l0
                level1 lfo2">
                <!--[if !supportLists]--><span style="mso-list:Ignore">1.<span
                    style="font:7.0pt "Times New Roman"">      
                  </span></span><!--[endif]--><span dir="LTR"></span>After
                connection establishment, and before streaming starts.<o:p></o:p></p>
              <p class="MsoPlainText"
                style="margin-left:.5in;text-indent:-.25in;mso-list:l0
                level1 lfo2">
                <!--[if !supportLists]--><span style="mso-list:Ignore">2.<span
                    style="font:7.0pt "Times New Roman"">      
                  </span></span><!--[endif]--><span dir="LTR"></span>After
                streaming stops.<o:p></o:p></p>
              <p class="MsoPlainText" style="margin-left:.5in"> <o:p></o:p></p>
              <p class="MsoPlainText">If the application would run
                normally I would expect to find similar output. – but
                for some reason the Bluetooth card change its
                active_profile from a2dp_sink to off, so, I assumed this
                may be the problem.<o:p></o:p></p>
              <p class="MsoPlainText">So after digging a little bit in
                the code, I found a condition in the
                ./src/modules/bluetooth/module-bluetooth-policy.c  that
                include all profiles except mine(a2dp source).<br>
                So I decided to apply the following hunk, to prevent the
                card changing its profile (it seemed reasonable for me,
                because all other profile are included in this
                condition).<o:p></o:p></p>
              <p class="MsoPlainText">Do you know this Bluetooth code?
                Does it make sense? Is there anyone I can ask to confirm
                it?<o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">static
                  pa_hook_result_t
                  profile_available_hook_callback(pa_core *c,
                  pa_card_profile *profile, void *userdata) {</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">   
                  pa_card *card;</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">   
                  const char *s;</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">   
                  bool is_active_profile;</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">   
                  pa_card_profile *selected_profile;</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5"> </span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">   
                  pa_assert(c);</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">   
                  pa_assert(profile);</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">   
                  pa_assert_se((card = profile->card));</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5"> </span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">    /*
                  Only consider bluetooth cards */</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">    s
                  = pa_proplist_gets(card->proplist,
                  PA_PROP_DEVICE_BUS);</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">    if
                  (!s || !pa_streq(s, "bluetooth"))</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">       
                  return PA_HOOK_OK;</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5"> </span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">    /*
                  Do not automatically switch profiles for headsets,
                  just in case */</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">    /*
                  TODO: remove a2dp and hsp when we remove BlueZ 4
                  support */</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">    if
                  (pa_streq(profile->name, "hsp") ||
                  pa_streq(profile->name, "a2dp") ||
                  pa_streq(profile->name, "a2dp_sink") ||</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">-     
                     pa_streq(profile->name, "a2dp_source") ||
                  pa_streq(profile->name, "headset_head_unit"))</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">+       
                  pa_streq(profile->name, "headset_head_unit")) {</span><o:p></o:p></p>
              <p class="MsoPlainText" style="text-indent:.5in"><span
                  style="color:#558ED5">        return PA_HOOK_OK;</span><o:p></o:p></p>
              <p class="MsoPlainText"><span style="color:#558ED5">…</span><o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText">It seemed it worked <span
                  style="font-family:Wingdings">J</span>, but the
                freezing issue still there
                <span style="font-family:Wingdings">L</span>.<o:p></o:p></p>
              <p class="MsoPlainText">When an a2dp connection is lost,
                pa would freeze when trying to reconnect and reload the
                Bluetooth modules.<o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText">gdb output:<o:p></o:p></p>
              <p class="MsoPlainText">(gdb) thread apply all bt<o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText">Thread 1 (process 1998):<o:p></o:p></p>
              <p class="MsoPlainText">#0  arm_modulus (p=1031,
                m=123328564) at ./ldso/ldso/arm/dl-sysdep.h:29<o:p></o:p></p>
              <p class="MsoPlainText">#1  _dl_lookup_sysv_hash
                (type_class=<optimized out>,<o:p></o:p></p>
              <p class="MsoPlainText">    undef_name=<optimized
                out>, hash=123328564, symtab=0xb6d0f3ec,<o:p></o:p></p>
              <p class="MsoPlainText">    tpnt=0xb6fc5508) at
                ldso/ldso/dl-hash.c:255<o:p></o:p></p>
              <p class="MsoPlainText">#2  _dl_find_hash (<o:p></o:p></p>
              <p class="MsoPlainText">    name=name@entry=0xbec1b5c0
                "module_bluez5_device_LTX_pa__get_deprecated",<o:p></o:p></p>
              <p class="MsoPlainText">    scope=<optimized out>,
                mytpnt=mytpnt@entry=0x0,<o:p></o:p></p>
              <p class="MsoPlainText">   
                type_class=type_class@entry=-2147483648,
                sym_ref=sym_ref@entry=0xbec1b558)<o:p></o:p></p>
              <p class="MsoPlainText">    at ldso/ldso/dl-hash.c:339<o:p></o:p></p>
              <p class="MsoPlainText">#3  0xb6d86b1c in do_dlsym
                (caller_address=<optimized out>,<o:p></o:p></p>
              <p class="MsoPlainText">    name=0xbec1b5c0
                "module_bluez5_device_LTX_pa__get_deprecated",<o:p></o:p></p>
              <p class="MsoPlainText">    vhandle=<optimized out>)
                at ldso/libdl/libdl.c:733<o:p></o:p></p>
              <p class="MsoPlainText">#4  dlsym (vhandle=<optimized
                out>,<o:p></o:p></p>
              <p class="MsoPlainText">    name=0xbec1b5c0
                "module_bluez5_device_LTX_pa__get_deprecated")<o:p></o:p></p>
              <p class="MsoPlainText">    at ldso/libdl/libdl.c:765<o:p></o:p></p>
              <p class="MsoPlainText">#5  0x000116d8 in
                bind_now_find_sym (d=<optimized out>,
                m=<optimized out>,<o:p></o:p></p>
              <p class="MsoPlainText">    symbol=<optimized out>)
                at daemon/ltdl-bind-now.c:101<o:p></o:p></p>
              <p class="MsoPlainText">#6  0xb6e039b8 in lt_dlsym () from
                /usr/lib/libltdl.so.7<o:p></o:p></p>
              <p class="MsoPlainText"><span
                  style="background:lime;mso-highlight:lime">#7 
                  0xb6f5b400 in pa_load_sym (handle=0x5e8f8,</span><o:p></o:p></p>
              <p class="MsoPlainText"><span
                  style="background:lime;mso-highlight:lime">   
                  module=module@entry=0xb686247a "module-bluez5-device",</span><o:p></o:p></p>
              <p class="MsoPlainText">    symbol=0xb6fa3121
                "pa__get_deprecated") at pulsecore/ltdl-helper.c:42<o:p></o:p></p>
              <p class="MsoPlainText">---Type <return> to
                continue, or q <return> to quit---<o:p></o:p></p>
              <p class="MsoPlainText">#8  0xb6f5d128 in pa_module_load
                (c=0x24f00,<o:p></o:p></p>
              <p class="MsoPlainText">    name=0xb686247a
                "module-bluez5-device",<o:p></o:p></p>
              <p class="MsoPlainText">   
                argument=argument@entry=0x5e2b0
                "path=/org/bluez/hci0/dev_98_D6_F7_34_98_E8") at
                pulsecore/module.c:151<o:p></o:p></p>
              <p class="MsoPlainText">#9  0xb6861ee0 in
                device_connection_changed_cb (y=<optimized out>,
                d=0x50bb8,<o:p></o:p></p>
              <p class="MsoPlainText">    u=0x38950) at
                modules/bluetooth/module-bluez5-discover.c:77<o:p></o:p></p>
              <p class="MsoPlainText">#10 0xb6f5b1a4 in pa_hook_fire
                (hook=0x37840, data=0x50bb8)<o:p></o:p></p>
              <p class="MsoPlainText">    at pulsecore/hook-list.c:104<o:p></o:p></p>
              <p class="MsoPlainText">#11 0xb684f8cc in
                endpoint_set_configuration (m=m@entry=0x50f10,<o:p></o:p></p>
              <p class="MsoPlainText">   
                userdata=userdata@entry=0x37830, conn=<optimized
                out>)<o:p></o:p></p>
              <p class="MsoPlainText">    at
                modules/bluetooth/bluez5-util.c:1313<o:p></o:p></p>
              <p class="MsoPlainText">#12 0xb684fcdc in endpoint_handler
                (c=<optimized out>, m=m@entry=0x50f10,<o:p></o:p></p>
              <p class="MsoPlainText">   
                userdata=userdata@entry=0x37830) at
                modules/bluetooth/bluez5-util.c:1517<o:p></o:p></p>
              <p class="MsoPlainText">#13 0xb6ddf800 in
                _dbus_object_tree_dispatch_and_unlock (tree=0x399e0,<o:p></o:p></p>
              <p class="MsoPlainText">    message=message@entry=0x50f10,
                found_object=found_object@entry=0xbec1b99c)<o:p></o:p></p>
              <p class="MsoPlainText">    at dbus-object-tree.c:1018<o:p></o:p></p>
              <p class="MsoPlainText">#14 0xb6dd1104 in
                dbus_connection_dispatch (connection=0x39c28)<o:p></o:p></p>
              <p class="MsoPlainText">    at dbus-connection.c:4718<o:p></o:p></p>
              <p class="MsoPlainText">#15 0xb6ec81b4 in dispatch_cb
                (ea=0x2124c, ev=0x35a20, userdata=0x407)<o:p></o:p></p>
              <p class="MsoPlainText">    at pulsecore/dbus-util.c:53<o:p></o:p></p>
              <p class="MsoPlainText">#16 0xb6f1a798 in dispatch_defer
                (m=<optimized out>) at pulse/mainloop.c:680<o:p></o:p></p>
              <p class="MsoPlainText">#17 pa_mainloop_dispatch
                (m=m@entry=0x21208) at pulse/mainloop.c:889<o:p></o:p></p>
              <p class="MsoPlainText">#18 0xb6f1ab98 in
                pa_mainloop_iterate (m=m@entry=0x21208,
                block=block@entry=1,<o:p></o:p></p>
              <p class="MsoPlainText">---Type <return> to
                continue, or q <return> to quit---<o:p></o:p></p>
              <p class="MsoPlainText">   
                retval=retval@entry=0xbec1ba9c) at pulse/mainloop.c:929<o:p></o:p></p>
              <p class="MsoPlainText">#19 0xb6f1abfc in pa_mainloop_run
                (m=m@entry=0x21208, retval=0xbec1ba9c,<o:p></o:p></p>
              <p class="MsoPlainText">    retval@entry=0xbec1ba94) at
                pulse/mainloop.c:944<o:p></o:p></p>
              <p class="MsoPlainText">#20 0x0000d9ec in main
                (argc=<optimized out>, argv=<optimized out>)<o:p></o:p></p>
              <p class="MsoPlainText">    at daemon/main.c:1134<o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText">-----Original Message-----<br>
                From: Tanu Kaskinen [<a moz-do-not-send="true"
                  href="mailto:tanuk@iki.fi">mailto:tanuk@iki.fi</a>] <br>
                Sent: Friday, August 14, 2015 12:00 PM<br>
                To: Eytan Naim; <a moz-do-not-send="true"
                  href="mailto:pulseaudio-discuss@lists.freedesktop.org">pulseaudio-discuss@lists.freedesktop.org</a><br>
                Subject: Re: [pulseaudio-discuss] pulseaudio a2dp
                disconnect problem<o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText">On Thu, 2015-08-13 at 12:35 +0000,
                Eytan Naim wrote:<o:p></o:p></p>
              <p class="MsoPlainText">> Hi Tanu,<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> Thanks for the reply.<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> I think that the loopback
                module shouldn’t be unloaded each time
                <o:p></o:p></p>
              <p class="MsoPlainText">> steaming stops for the simple
                reason that it is loaded when connection
                <o:p></o:p></p>
              <p class="MsoPlainText">> is established, and not when
                streaming starts.<o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText">Yes, that's oddly asymmetric, and
                should perhaps be fixed. That said, as long as
                module-loopback gets loaded again when the streaming
                continues, the current logic shouldn't necessarily cause
                too much trouble. In your case module-loopback doesn't
                get loaded again, but that might be because pulseaudio
                gets stuck before that has a chance to happen.<o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText">> I get all kind of PulseAudio
                problems, for example in the example
                <o:p></o:p></p>
              <p class="MsoPlainText">> below, PulseAudio success to
                stream in the start, but after pausing
                <o:p></o:p></p>
              <p class="MsoPlainText">> and playing again PulseAudio
                act differently.<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> - It looks like PulseAudio
                has problem to handle changing connection
                <o:p></o:p></p>
              <p class="MsoPlainText">> state or something.<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> The below log was produced by
                the following steps:<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> a)      connection
                establishment<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> b)      streaming session<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> c)       stop from remote
                device<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> d)      unloading loopback
                module<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> e)      toggling streaming
                start/stop without PulseAudio suitable
                <o:p></o:p></p>
              <p class="MsoPlainText">> response<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> f)       pacmd failure for
                long time (more then 3-4 minutes). – so
                <o:p></o:p></p>
              <p class="MsoPlainText">> it’s probably not a dbus
                thing.<o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> <o:p></o:p></p>
              <p class="MsoPlainText">> Please notice that each time
                I try a test, something a little
                <o:p></o:p></p>
              <p class="MsoPlainText">> different happens- but it
                always has to do with modules
                <o:p></o:p></p>
              <p class="MsoPlainText">> unloading/PulseAudio doesn’t
                response<o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText">Getting stuck is the most
                interesting problem here. Can you run pulseaudio in gdb,
                and when it gets stuck, stop and give command "thread
                apply all bt"?<o:p></o:p></p>
              <p class="MsoPlainText"> <o:p></o:p></p>
              <p class="MsoPlainText">--<o:p></o:p></p>
              <p class="MsoPlainText">Tanu<o:p></o:p></p>
              <p class="MsoNormal"><span
                  style="font-size:12.0pt;font-family:"Times New
                  Roman , serif","serif""> </span><o:p></o:p></p>
            </blockquote>
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman , serif","serif""><br>
                It is correct that the profile is set to "off" when a
                stream stops. The a2dp connection<br>
                is torn down on the bluetooth end, so it would not make
                sense to keep the profile in<br>
                pulesaudio. This is definitely not the cause of your
                problem. And actually I cannot<br>
                see that it's asymmetric. The loopback module is loaded
                as soon as the profile is<br>
                switched to a2dp and unloaded as soon as the profile
                changes to "off".<br>
                BTW, you can avoid loading and unloading the loopback
                module automatically by<br>
                loading module-bluetooth-policy with argument
                a2dp_source=0. But then you have<br>
                to load the loopback manually and move it to the right
                source. Maybe it is a good idea<br>
                to test that because the issue might also be caused by
                module-bluetooth-policy.<br>
                <br>
                The phone application I wrote handles insertion of
                loopback modues and does not<br>
                rely on module-bluetuetooth policy for that. Up to now I
                have not seen a similar<br>
                issue, the application reacts to switches between
                a2dp/hsp/off without problems. 
                <br>
                <br>
                Georg </span><o:p></o:p></p>
            <p class="MsoNormal"><span
                style="font-size:12.0pt;font-family:"Times New
                Roman","serif""><o:p> </o:p></span></p>
          </blockquote>
          <p class="MsoNormal" style="margin-bottom:12.0pt"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman","serif"">Hi,<br>
              my main point was that you should test it with
              a2dp_source=0 as<br>
              argument to module-bluetooth-policy, because I am using it
              that<br>
              way and it works without issues. It might help to narrow
              down the<br>
              problem.<br>
              I won't argue about the symmetry.<br>
              <br>
              Regards<br>
                           Georg <o:p></o:p></span></p>
        </blockquote>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif"">I just tested it for my
            setup. When I connect my phone (Galaxy S6), it initially<br>
            connects the HSP profile (probably because I am running
            ofono). When I start<br>
            playing music it switches to a2dp and when I pause it goes
            to off. Resuming the<br>
            stream works, it goes back to a2dp as expected.<br>
            <br>
            But I hit another issue: When I completely disconnect the
            phone and re-connect it<br>
            and then try to play music again, pulseaudio crashes with
            following message:<br>
            <br>
            [pulseaudio] source.h: Assertion
            'pa_object_refcnt(pa_object_cast(o)) > 0' failed at
            ./pulsecore/source.h:249, function pa_source_assert_ref().
            Aborting.<br>
            <br>
            Regards<br>
                         Georg<o:p></o:p></span></p>
      </div>
      <br>
    </blockquote>
    Yes, I do not see any freezes and everything works as expected<br>
    (apart from the crash mentioned above). But - as already said -<br>
    I am using module-bluetooth-policy with a2dp_source=0 and<br>
    hfgw=0 and let my application take care of the loopback modules.<br>
    <br>
    Georg<br>
  </body>
</html>