A2DP(Advanced Audio DistributionProfile)是蓝牙的音频传输协议,典型应用为蓝牙耳机。A2DP协议的音频数据在ACL Link上传输,这与SCO上传输的语音数据要区别。A2DP不包括远程控制的功能,远程控制的功能参考协议AVRCP。AVDTP则定义了蓝牙设备之间数据流句柄的参数协商,建立和传输过程以及相互交换的信令实体形式,该协议是A2DP框架的基础协议。A2DP与相关协议的附属关系如下图:
注意下数据包装的过程。
SBC是A2DP规定的强制支持的编码格式,这里我们具体只讨论这一种编码格式:
Media payload的格式如下:
其中Media Payload的Header部分的格式如下:
F bit – Set to 1 if the SBC frame isfragmented, otherwise set to 0.
S bit – Set to 1 for the starting packet of afragmented SBC frame, otherwise set to 0.
L bit – Set to 1 for the last packet of afragmented SBC frame, otherwise set to 0
RFA – 置为0.
Number of frames (4 bits) – If the F bit is setto 0, this field indicates the number of
frames contained in this packet. If the F bitis set to 1, this field indicates the number
of remaining fragments, including the currentfragment. Thus the last counter value
shall be one. For example, if there are threefragments then the counter has value 3,
2 and 1 for subsequent fragments. This field isexpressed by 4 bit UiMsbf.
7.A2DP的通信过程
A2DP规定Sink个Source端有三种状态:IDLE、OPEN和STREAM,通过下图的流程进行状态转换:
前提是L2CAP首先建立signaling Channel.
Start Streaming:
原文:https://mp.weixin.qq.com/s/cKZKtrbJ2IP6tUtK3T0qGg