天天看點

Android9 藍牙開發學習(2)——BluetoothA2dpSinkBluetoothA2dpSink

BluetoothA2dpSink

主要實作a2dp協定及其接口,主要連上後接收音頻資料

A2DP 全名是Advenced Audio Distribution Profile 藍牙音頻傳輸模型協定.

source端作為音頻的輸入端對音頻資料進行編碼後,通過兩個裝置之間建立的ACL鍊路發送給對方裝置(sink端),在sink端收到音頻資料後,進行解碼操作還原出音頻完成audio資料傳輸。

BluetoothA2dpSink初始化

// 初始化
bluetoothAdapter.getProfileProxy(context, serviceListener, BluetoothProfile.A2DP_SINK);
//還要實作BluetoothProfile.ServiceListener接口,在onServiceConnected中擷取bluetoothA2dpSink對象
    private B