为a2dp解码MPEG 2,4 AAC-LC LATM比特流

时间:2016-03-10 11:33:47

标签: bluetooth aac mpeg-4 a2dp

我正在尝试解码从Apple iPhone收到的用于蓝牙A2DP配置文件的比特流。

根据Apple的说法,结构应该是

Bitstream structure

我的样本比特流是

  

36 00 47 00 | 80 60 00 01 00 06 3c ab 00 00 00 00 |   47 fc 00 00 b0 90 80 03 00 20 20 66 00 01 98 00 0d e1 20 00 00 00 00   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1c

前四个字节是L2CAP,接下来的12个是AVDTP。但我无法解码剩余的字节。请帮助。

我见过定义AudioMuxElement的ISO 14496-3,但我仍然无法将其与字节相关联。

3 个答案:

答案 0 :(得分:2)

最近,我遇到了同样的问题。由于在一张纸上解码比特流不是很方便,我已经基于ISO / IEC 14496-3参考实现创建了一个简单的decoder(用于调试目的)。

正确解码来自问题的流:

useSameStreamMux:1             = 0 => 0
audioMuxVersion:1              = 1 => 1
audioMuxVersionA:1             = 0 => 0
bytesForValue:2                = 00 => 0
valueTmp:8                     = 11111111 => 255 (taraBufferFullness)
allStreamsSameTimeFraming:1    = 1 => 1
numSubFrames:6                 = 000000 => 0
numProgram:4                   = 0000 => 0
numLayer:3                     = 000 => 0
bytesForValue:2                = 00 => 0
valueTmp:8                     = 00010110 => 22 (ascLen)
audioObjectType:5              = 00010 => 2
samplingFrequencyIndex:4       = 0100 => 4
channelConfiguration:4         = 0010 => 2
frameLengthFlag:1              = 0 => 0
dependsOnCoreCoder:1           = 0 => 0
extensionFlag:1                = 0 => 0
fillBits:6                     = 000000 => 0
frameLengthType:3              = 000 => 0
latmBufferFullness:8           = 11000000 => 192
otherDataPresent:1             = 0 => 0
crcCheckPresent:1              = 0 => 0
tmp:8                          = 00100000 => 32 (MuxSlotLengthBytes)
payload:8                      = 00100000 => 32
...
payload:8                      = 00011100 => 28
byteAlign:0                    = 0 => 0

答案 1 :(得分:1)

“ISO / IEC 14496-3,子部分1:主要部分,第1.6节:与14496-1的接口”是正确的选择。

首先看看AudioSyncStream()

AudioSyncStream()
{
    while(nextbits()==0x2B7)        // 11-bits
    {
       audioMuxLengthBytes;         // 13-bit 
       AudioMuxElement(1);          // proceed to decode AudioMuxElement
    }
}

LATM应该以11位长同步字开始:syncword==(2B7)hex==(1010110111)bin。您的信息流似乎不是这种情况:(47FC)hex==(0100011111111100)bin,前11位为(01000111111)bin

答案 2 :(得分:0)

我能够按如下方式解码标题:

Use same stream config       = 0 (1 bit)

StreamMuxConfig():

AudioMuxVersion              = 1 (1 bit)
AudioMuxVersionA             = 0 (1 bit)
LATM value Temp Bytes        = 00 (2 bit)
Fullness value               = 1111 1111 ( 8 Bit)
AllStreamsUseSameTimeFrame   = 1 (1 bit)
numSubFrames                 = 000000 (6 bits)
num program                  = 0000 (4 bits)
num layer                    = 000 ( 3 bits)
use same config              = 0 (1 bit)
Fill + other bits            = 0000 1010 0 (9 bits)

AudioSpecificConfig():

Object Type (aac)            = 00010 ( 5 bits)
Sample Type                  = 0100 ( 4 bits)
Channel                      = 0010 ( 4 bits)
GAS specific config          = 000 (3 bits)

看起来我的版本规格较旧。要查找的正确版本的ISO是ISO / IEC 14496-3:2005。此外,Apple的蓝牙设计指南文档中也存在拼写错误(它指的是不存在的文档13818-3:2005!)。