Apply gain to the audio track stream
Problem: While bluetooth is streaming media (with appropriate audio focus), any other media/audio app can acquire transient audio focus i.e. AUDIOFOCUS_GAIN_TRANSIENT and AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK This results in bluetooth process to receive the respective LOSS events. When it receives the AUDIOFOCUS_LOSS_TRANSIENT it sends a pause command to the remote device. In addition, it also mutes the stream in case the remote device rejects the pause command to ensure no sound is made by the bluetooth process. The logic to set the gain was broken post the lib AAudio migration resulting in bluetooth process making additional sound on top of the other audio app. Similarly, when other media/audio app had requested for gain_may_duck focus, bluetooth process wasn't ducking the media sound resulting in overlap of both the audio. Solution: Updated the business logic to update the stream buffer based on the gain value set by the bluetooth process. On different transient audio focus events, different gain (in range of [0.0f,1.0f]) is set by the handler. On focus gain event, it sets back the gain to 1.0f. Bug:254724838 Tag:#stability Test: Tested by setting the different gain value in the code and validating on device. Change-Id: Iafedf759949df6e54cad7f21d64dc247712fd380
Loading
Please register or sign in to comment