<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [bluetooth] wrong SBC configuration on big endian platforms"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=91359">91359</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[bluetooth] wrong SBC configuration on big endian platforms
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>PulseAudio
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>modules
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>pulseaudio-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>p06@o2.pl
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>pulseaudio-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>lennart@poettering.net
          </td>
        </tr></table>
      <p>
        <div>
        <pre>PLATFORM:
AR9311 MIPS 24K SoC
OpenWRT Chaos Calmer 15.05
BlueZ 5.32
PulseAudio 6.0

PROBLEM:
White noise when streaming audio over A2DP from bluetooth device to PA server
running on big endian platforms.

CAUSE:
method bt_transport_config_a2dp() in
src/modules/bluetooth/module-bluez4-device.c  
method transport_config() in src/modules/bluetooth/module-bluez5-device.c

The current code assumes that endianness of the data returned by SBC is always
little endian and configure the transport in this way:

module-bluez4-device.c
1707|    u->sample_spec.format = PA_SAMPLE_S16LE;

module-bluez5-device.c
1159|    u->sample_spec.format = PA_SAMPLE_S16LE;

However an endianness in default settings returned by SBC is set according to
endianness of target platform:

1025|        sbc->blocks = SBC_BLK_16;
1026|        sbc->bitpool = 32;
1027|    #if __BYTE_ORDER == __LITTLE_ENDIAN
1028|        sbc->endian = SBC_LE;
1029|    #elif __BYTE_ORDER == __BIG_ENDIAN
1030|        sbc->endian = SBC_BE;
1031|    #else
1032|    #error "Unknown byte order"
1033|    #endif

see:
<a href="http://git.kernel.org/cgit/bluetooth/sbc.git/tree/sbc/sbc.c#n1027">http://git.kernel.org/cgit/bluetooth/sbc.git/tree/sbc/sbc.c#n1027</a>

Thus on big endian platforms SBC returns data in big endian format but PA
treats it as little endian, which results with white noise.

SOLUTION:

Explicitly set SBC configuration to produce little endian data by adding:

module-bluez4-device.c
1714|    sbc_info->sbc.endian = SBC_LE;

module-bluez5-device.c
1167|    sbc_info->sbc.endian = SBC_LE;

WORKAROUND:
not known.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>