SBC是强制支持的(Mandatory Codec),其余三种可选(Optional
Codec),除了这些外,也可以有厂家自己的编码形式(Vendor Specific A2DP Codecs)。
SBC是A2DP规定的强制支持的编码格式,这里我们具体只讨论这一种编码格式:
参数Sampling Frequency:
Sink端必须支持44100和48000这两种frequency,Source端支持一种就行。
参数Channel Mode:
参数Block Length:
参数Subbands:
参数Allocation Method:
参数Minimum / Maximum Bitpool
Value:
6.Media Packet Header与Media
payload:
在第一部分数据的包装中可以看出,在每一个Media payload上都会加上Media
packrt header。主要包括以下几个部分:
Timestamp (TS),Payload Type
(PT),Marker (M) bit【置为全0】,Extension (X)
bit【不使用,置为全0】。具体在AVDTP协议中定义,这里不详述。
Media payload的格式如下:
其中Media Payload的Header部分的格式如下:
F bit – Set to 1 if the SBC frame is fragmented,
otherwise set to 0.
S bit – Set to 1 for the starting packet of a fragmented SBC
frame, otherwise set to 0.
L bit – Set to 1 for the last packet of a fragmented SBC
frame, otherwise set to 0
RFA – 置为0.
Number of frames (4 bits) – If the F bit is set to 0, this
field indicates the number of
frames contained in this packet. If the F bit is set to 1,
this field indicates the number
of remaining fragments, including the current fragment. Thus
the last counter value
shall be one. For example, if there are three fragments then
the counter has value 3,
2 and 1 for subsequent fragments. This field is expressed by 4
bit UiMsbf.
7.A2DP的通信过程
A2DP规定Sink个Source端有三种状态:IDLE、OPEN和STREAM,通过下图的流程进行状态转换:
Connection Establishment:
前提是L2CAP首先建立signaling Channel.
Start Streaming:
OPEN状态下经过Start Stream 过程就转换到STREAMING状态。
Connection Release:
在OPEN和STREAMING状态下都可以通过Stream Release过程变为IDLE状态。
Suspend:
只能从STREAMING状态通过Stream Suspend过程变为OPEN。
Change Parameters: