I have root, will try to figure it out. I wonder which file will handle this? Can you post the Adb results you're seeing to determine whether apps are using android mixer or not?
The problem is likely in the flinger/mixer routines that are part of the libraries used for sound. The mixer does whatever it wants really..based on source sample rate...what else is going on ...and some complex decisions that likely factor in barometric pressure and ambient temperature (LoL). Upsampling and downsampling are not done well. bottom line -- lots of ripple and noise.
When played correctly and sounding right the adb ouput with the following command is as such:
adb shell dumpsys media.audio_flinger
Output thread 0xf418f000 type 1 (DIRECT):
Thread name: AudioOut_25D
I/O handle: 605
TID: 22141
Standby: no
Sample rate: 44100 Hz
HAL frame count: 1344
HAL format: 0x5 (pcmfloat)
HAL buffer size: 10752 bytes
Channel count: 2
Channel mask: 0x00000003 (front-left, front-right)
Processing format: 0x5 (pcmfloat)
Processing frame size: 8 bytes
Pending config events: none
Output device: 0x4 (WIRED_HEADSET)
Input device: 0 (NONE)
Audio source: 0 (default)
Normal frame count: 1344
Last write occurred (msecs): 32
Total writes: 201
Delayed writes: 0
Blocked in write: yes
Suspend count: 0
Sink buffer : 0xf4243000
Mixer buffer: 0xf4712000
Effect buffer: 0xf51d8800
Fast track availMask=0xfe
Standby delay ns=1000000000
AudioStreamOut: 0xf66a6e98 flags 0x2001 (DIRECT|0x2000)
Stream volumes in dB: 0:-6.8, 1:-28, 2:-28, 3:-28, 4:-28, 5:-28, 6:0, 7:-28, 8:-23, 9:-96, 10:0, 11:-28, 12:0, 13:0
Normal mixer raw underrun counters: partial=0 empty=0
1 Tracks of which 1 are active
Name Active Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
none yes 20012 3 00000005 00000003 1129 7072 A 3 44100 0 0 00042480 0xf4243000 0x0 0x000 0
0 Effect Chains
But a few moments later --- at seemingly random intervals ….The sound somehow initializes different….and Android settles down to play it like this …and it sounds terrible (same exact track):
Library volume_listener
Volume listener for notification / Qualcomm Technologies Inc
UUID: 0b776dde-0590-11e5-81ba-0025b32654a0
TYPE: 0b776dde-0590-11e5-81ba-0025b32654a0
apiVersion: 00020000
flags: 00400280
Volume listener for voice call / Qualcomm Technologies Inc
UUID: 0ace5c08-0590-11e5-ae9e-0025b32654a0
TYPE: 0ace5c08-0590-11e5-ae9e-0025b32654a0
apiVersion: 00020000
flags: 00400280
Volume listener for alarm / Qualcomm Technologies Inc
UUID: 09f303e2-0590-11e5-8fdb-0025b32654a0
TYPE: 09f303e2-0590-11e5-8fdb-0025b32654a0
apiVersion: 00020000
flags: 00400280
Volume listener for ring / Qualcomm Technologies Inc
UUID: 0956df94-0590-11e5-bdbe-0025b32654a0
TYPE: 0956df94-0590-11e5-bdbe-0025b32654a0
apiVersion: 00020000
flags: 00400280
Volume listener for Music / Qualcomm Technologies Inc.
UUID: 08b8b058-0590-11e5-ac71-0025b32654a0
TYPE: 08b8b058-0590-11e5-ac71-0025b32654a0
apiVersion: 00020000
flags: 00400280
Library audio_pre_processing
Noise Suppression / Qualcomm Fluence
UUID: 1d97bb0b-9e2f-4403-9ae3-58c2554306f8
TYPE: 58b4b260-8e06-11e0-aa8e-0002a5d5c51b
apiVersion: 00020000
flags: 00000203
Acoustic Echo Canceler / Qualcomm Fluence
UUID: 0f8d0d2a-59e5-45fe-b6e4-248c8a799109
TYPE: 7b491460-8d4d-11e0-bd61-0002a5d5c51b
apiVersion: 00020000
flags: 00000203
Library offload_bundle
(no effects)
Library proxy
Visualizer / The Android Open Source Project
UUID: 1d0a1a53-7d5d-48f2-8e71-27fbd10d842c
TYPE: e46b26a0-dddd-11db-8afd-0002a5d5c51b
apiVersion: 00020000
flags: 00400008
Insert Preset Reverb / NXP Software Ltd.
UUID: f3e178d2-ebcb-408e-8357-0002a5d5c51b
TYPE: 47382d60-ddd8-11db-bf3a-0002a5d5c51b
apiVersion: 00020000
flags: 00400048
Auxiliary Preset Reverb / NXP Software Ltd.
UUID: 1b78f587-6d1c-422e-8b84-0002a5d5c51b
TYPE: 47382d60-ddd8-11db-bf3a-0002a5d5c51b
apiVersion: 00020000
flags: 00400001
Insert Environmental Reverb / NXP Software Ltd.
UUID: b707403a-a1c1-4291-9573-0002a5d5c51b
TYPE: c2e5d5f0-94bd-4763-9cac-4e234d06839e
apiVersion: 00020000
flags: 00400048
Auxiliary Environmental Reverb / NXP Software Ltd.
UUID: 48404ac9-d202-4ccc-bf84-0002a5d5c51b
TYPE: c2e5d5f0-94bd-4763-9cac-4e234d06839e
apiVersion: 00020000
flags: 00400001
Equalizer / NXP Software Ltd.
UUID: c8e70ecd-48ca-456e-8a4f-0002a5d5c51b
TYPE: 0bed4300-ddd6-11db-8f34-0002a5d5c51b
apiVersion: 00020000
flags: 00400048
Qualcomm Technologies Virtualizer / Qualcomm Technologies, Inc.
UUID: d3467faa-acc7-4d34-acaf-0002a5d5c51b
TYPE: 37cc2c00-dddd-11db-8577-0002a5d5c51b
apiVersion: 00020000
flags: 00400290
Qualcomm Technologies Bass Boost / Qualcomm Technologies, Inc.
UUID: 14804144-a5ee-4d24-aa88-0002a5d5c51b
TYPE: 0634f220-ddd4-11db-a0fc-0002a5d5c51b
apiVersion: 00020000
flags: 00400290
Library loudness_enhancer
Loudness Enhancer / The Android Open Source Project
UUID: fa415329-2034-4bea-b5dc-5b381c8d1e2c
TYPE: fe3199be-aed0-413f-87bb-11260eb63cf1
apiVersion: 00020000
flags: 00000008
Library downmix
Multichannel Downmix To Stereo / The Android Open Source Project
UUID: 93f04452-e4fe-41cc-91f9-e475b6d1d69f
TYPE: 381e49cc-a858-4aa2-87f6-e8388e7601b2
apiVersion: 00020000
flags: 00000008
Library visualizer_hw
(no effects)
Library visualizer_sw
(no effects)
Library qcreverb
(no effects)
Library qcvirt
(no effects)
Library qcbassboost
(no effects)
Library reverb
(no effects)
Library bundle
Volume / NXP Software Ltd.
UUID: 119341a0-8469-11df-81f9-0002a5d5c51b
TYPE: 09e8ede0-ddde-11db-b4f6-0002a5d5c51b
apiVersion: 00020000
flags: 00000050
Clients:
pid: 20012
Notification Clients:
pid: 915
pid: 943
pid: 1571
pid: 2494
pid: 2975
pid: 3312
pid: 3409
pid: 3482
pid: 8883
pid: 10381
pid: 10401
pid: 14035
pid: 18631
pid: 20012
Global session refs:
session pid count
1137 20012 1
Hardware status: 0
Standby Time mSec: 3000
Output thread 0xf5183840 type 0 (MIXER):
Thread name: AudioOut_D
I/O handle: 13
TID: 1382
Standby: yes
Sample rate: 48000 Hz
HAL frame count: 192
HAL format: 0x1 (pcm16)
HAL buffer size: 768 bytes
Channel count: 2
Channel mask: 0x00000003 (front-left, front-right)
Processing format: 0x5 (pcmfloat)
Processing frame size: 8 bytes
Pending config events: none
Output device: 0 (NONE)
Input device: 0 (NONE)
Audio source: 0 (default)
Normal frame count: 960
Last write occurred (msecs): 2136471
Total writes: 3235
Delayed writes: 0
Blocked in write: no
Suspend count: 0
Sink buffer : 0xf5d4b000
Mixer buffer: 0xf5d49000
Effect buffer: 0xf5d44000
Fast track availMask=0xfe
Standby delay ns=3000000000
AudioStreamOut: 0xf66a5998 flags 0x6 (PRIMARY|FAST)
Thread throttle time (msecs): 0
AudioMixer tracks: 0x00000000
Master mono: off
FastMixer command=COLD_IDLE writeSequence=32494 framesWritten=3119424
numTracks=1 writeErrors=0 underruns=14 overruns=6
sampleRate=48000 frameCount=192 measuredWarmup=15.3 ms, warmupCycles=6
mixPeriod=4.00 ms
Simple moving statistics over last 3.4 seconds:
wall clock time in ms per mix cycle:
mean=4.00 min=1.31 max=6.70 stddev=0.17
raw CPU load in us per mix cycle:
mean=163 min=0 max=477 stddev=62
Fast tracks: sMaxFastTracks=8 activeMask=0x1
Index Active Full Partial Empty Recent Ready
0 yes 810 0 0 full 1152
1 no 0 0 0 full 0
2 no 0 0 0 full 0
3 no 0 0 0 full 0
4 no 0 0 0 full 0
5 no 0 0 0 full 0
6 no 0 0 0 full 0
7 no 0 0 0 full 0
Stream volumes in dB: 0:0, 1:-22, 2:-4.5, 3:0, 4:-24, 5:-35, 6:0, 7:-12, 8:-6, 9:0, 10:0, 11:0, 12:0, 13:0
Normal mixer raw underrun counters: partial=0 empty=0
0 Tracks
0 Effect Chains
Output thread 0xf4e037c0 type 0 (MIXER):
Thread name: AudioOut_15
I/O handle: 21
TID: 1384
Standby: no
Sample rate: 48000 Hz
HAL frame count: 1920
HAL format: 0x1 (pcm16)
HAL buffer size: 7680 bytes
Channel count: 2
Channel mask: 0x00000003 (front-left, front-right)
Processing format: 0x1 (pcm16)
Processing frame size: 4 bytes
Pending config events: none
Output device: 0x4 (WIRED_HEADSET)
Input device: 0 (NONE)
Audio source: 0 (default)
Normal frame count: 1920
Last write occurred (msecs): 25
Total writes: 39452
Delayed writes: 0
Blocked in write: yes
Suspend count: 0
Sink buffer : 0xf5d4d000
Mixer buffer: 0xf5514000
Effect buffer: 0xf5d4f000
Fast track availMask=0xfe
Standby delay ns=3000000000
AudioStreamOut: 0xf66a5a08 flags 0x8 (DEEP_BUFFER)
Thread throttle time (msecs): 400
AudioMixer tracks: 0x00000001
Master mono: off
FastMixer not initialized
Stream volumes in dB: 0:-6.8, 1:-28, 2:-28, 3:-28, 4:-28, 5:-28, 6:0, 7:-28, 8:-23, 9:-96, 10:0, 11:-28, 12:0, 13:0
Normal mixer raw underrun counters: partial=0 empty=0
1 Tracks of which 1 are active
Name Active Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
0 yes 20012 3 00000005 00000003 1137 7072 A 3 44100 0 0 00C22CF8 0xf5d4d000 0x0 0x000 1768
0 Effect Chains
Output thread 0xf4c83d40 type 0 (MIXER):
Thread name: AudioOut_1D
I/O handle: 29
TID: 1388
Standby: yes
Sample rate: 48000 Hz
HAL frame count: 768
HAL format: 0x1 (pcm16)
HAL buffer size: 3072 bytes
Channel count: 2
Channel mask: 0x00000003 (front-left, front-right)
Processing format: 0x5 (pcmfloat)
Processing frame size: 8 bytes
Pending config events: none
Output device: 0 (NONE)
Input device: 0 (NONE)
Audio source: 0 (default)
Normal frame count: 1152
Last write occurred (msecs): 9394420
Total writes: 0
Delayed writes: 0
Blocked in write: no
Suspend count: 0
Sink buffer : 0xf51e5800
Mixer buffer: 0xf51e3000
Effect buffer: 0xf5d74400
Fast track availMask=0xfe
Standby delay ns=3000000000
AudioStreamOut: 0xf66a5b20 flags 0 (NONE)
Thread throttle time (msecs): 0
AudioMixer tracks: 0x00000000
Master mono: off
FastMixer command=COLD_IDLE writeSequence=0 framesWritten=0
numTracks=0 writeErrors=0 underruns=0 overruns=0
sampleRate=0 frameCount=0 measuredWarmup=0 ms, warmupCycles=0
mixPeriod=nan ms
No FastMixer statistics available currently
Fast tracks: sMaxFastTracks=8 activeMask=0
Index Active Full Partial Empty Recent Ready
0 no 0 0 0 full 0
1 no 0 0 0 full 0
2 no 0 0 0 full 0
3 no 0 0 0 full 0
4 no 0 0 0 full 0
5 no 0 0 0 full 0
6 no 0 0 0 full 0
7 no 0 0 0 full 0
Stream volumes in dB: 0:0, 1:-22, 2:-4.5, 3:0, 4:-24, 5:-35, 6:0, 7:-12, 8:-6, 9:0, 10:0, 11:0, 12:0, 13:0
Normal mixer raw underrun counters: partial=0 empty=0
0 Tracks
0 Effect Chains
Reroute submix audio module:
route[0] rate in=0 out=0, addr=[]
route[1] rate in=0 out=0, addr=[]
route[2] rate in=0 out=0, addr=[]
route[3] rate in=0 out=0, addr=[]
route[4] rate in=0 out=0, addr=[]
route[5] rate in=0 out=0, addr=[]
route[6] rate in=0 out=0, addr=[]
route[7] rate in=0 out=0, addr=[]
route[8] rate in=0 out=0, addr=[]
route[9] rate in=48000 out=48000, addr=[]