Bluedroid protocol stack a2dp audio fluctuating processing method

When listening to music with Bluetooth headsets, you will encounter intermittent sound. Based on work experience, the following is summarized:

1: dump audio data

In the Bluedroid protocol stack, the macro BT_AUDIO_SAMPLE_LOG in audio_a2dp_hw.c is turned on, and the pcm data sent to the bluetooth HAL layer is saved in the phone's /data/audio/ and named as output_sampleX.pcm format.

You can use the cool edit pro tool to analyze whether there is a problem with the PCM data

 

2: The data packet is discarded in the protocol

First make the following settings:

1) Modify the log output level of the bt_stack.conf configuration file to 5 (the default is 2)

2) Collect BT snoop log, check "Enable Bluetooth HCI snoop log" in the developer options or set BtSnoopLogOutput to true in bt_stack.conf.

 

Check if there are:

btif_media_aa_prep_2_send congestion buf count xxx

L2CA_FlushChannel() flushed: 0 + 0, num_left: xxx format data output.

Then use frontline's ComProbe Protocol Analysis System to analyze the transmission of the snoop log a2dp data packet obtained

 

3: Android4.1 and above can analyze the performance of the device through the Systrace tool.

Open the macro BT_AUDIO_SYSTRACE_LOG in bluedroid

Enter the platform-tools/systrace of the sdk

Implementation: python systrace.py --time=10 -o a2dptrace.html sched gfx view wm

Use a browser to open a2dptrace.html, the specific usage is still under study, and will be added later

Guess you like

Origin blog.csdn.net/lgdlchshg/article/details/41043095