--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "android-ndk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-ndk/HP1n8fphSs0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-ndk...@googlegroups.com.
Thanks for the additional ps and dumpsys outputs; I'll summarize what I see in them:
In mediaserver process, FastMixer thread has:
PRIO -4, NICE -19, RTPRI 3, SCHED 1
This is the so-called "Fast mixer" which drives the audio output
and receives and mixes input from all the fast tracks.
mediaserver process also has an AudioTrack thread with
PRIO 4, NICE -16, RTPRI 0, SCHED 0
This thread is not relevant to the discussion here,
but it's a good example of a thread with elevated priority,
but not realtime priority. This is what all normal user threads can do
to themselves. It's probably there for some internal sound, maybe a ringtone
or notification.
Then in your app process there is an AudioTrack thread with
PRIO -3, NICE -16, RTPRI 2, SCHED 1
This thread handles OpenSL ES callbacks, such as buffer queue completion.
I don't know for a fact that these small min values are the cause of the clicks
you hear, but they could certainly be a contributor and it could make sense to start there.
> adb shell dumbsys media.audio_flinger
Clients:
pid: 502 {systerm_server}
pid: 618 {com.android.systemui}
pid: 792 {com.android.phone}
pid: 3476 {com.android.mono:remote}
Notification Clients:
pid: 125 {/system/bin/mediaserver}
pid: 502 {system_server}
pid: 618 {com.android.systemui}
pid: 792 {com.android.phone}
pid: 3476 {com.rdio.android.mono:remote}
pid: 3626 {com.rdio.android.ui:remote}
Global session refs:
session pid count
6 792 1
11 3476 1
22 3626 1
23 3626 1
26 618 2
27 618 1
28 502 1
Hardware status: 0
Standby Time mSec: 3000
Output thread 0x40ca5008 internals
Normal frame count: 1024
last write occurred (msecs): 22
total writes: 46167
delayed writes: 0
blocked in write: 1
suspend count: 0
mix buffer : 0x413a52e0
Fast track availMask=0xd0
io handle: 2
TID: 527
standby: 0
Sample rate: 44100
HAL frame count: 512
Channel Count: 2
Channel Mask: 0x00000003
Format: 1
Frame size: 4
Pending setParameters commands:
Index Command
Pending config events:
AudioMixer tracks: 00000037
FastMixer command=MIX_WRITE writeSequence=184729 framesWritten=47289856
numTracks=2 writeErrors=1 underruns=0 overruns=2
sampleRate=44100 frameCount=512 measuredWarmup=78.6 ms, warmupCycles=4
mixPeriod=11.61 ms
Simple moving statistics over last 380.4 seconds:
wall clock time in ms per mix cycle:
mean=11.61 min=8.25 max=14.79 stddev=0.14
raw CPU load in us per mix cycle:
mean=327 min=51 max=1756 stddev=101
Distribution of mix cycle times in ms for the tails (> ~3 stddev outliers):
left tail: mean=9.60 min=8.25 max=10.38 stddev=0.64
right tail: mean=13.52 min=12.81 max=14.79 stddev=0.63
Fast tracks: kMaxFastTracks=8 activeMask=0x9
Index Active Full Partial Empty Recent Ready
0 yes 173 0 0 full 2048
1 no 0 0 0 full 0
2 no 32 2 5 empty 0
3 yes 13 0 18 full 512
4 no 16 2 6 empty 0
5 no 35 3 15 empty 0
6 no 0 0 0 full 0
7 no 0 0 0 full 0
Output thread 0x40ca5008 stream volumes in dB:
0:-8.2, 1:-27, 2:-21, 3:-14, 4:-14, 5:-21, 6:0, 7:-27, 8:-22, 9:-14
Output thread 0x40ca5008 tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
F 1 792 0 00000001 00000001 6 512 I 0 44100 -10 -10 00000000 413A52E0 00000000 0x000 0
F 2 618 1 00000001 00000003 27 8329 S 1 44100 -Inf -Inf 00002089 413A52E0 00000000 0x600 0
1 618 5 00000001 00000003 26 4096 S 1 44100 0 0 0000F800 413A52E0 00000000 0x400 1024
F 5 502 1 00000001 00000003 28 4146 S 1 44100 -Inf -Inf 00001032 413A52E0 00000000 0x600 0
F 3 3476 3 00000001 00000003 11 512 A 1 44100 0 0 02B81400 413A52E0 00000000 0x400 8192
Output thread 0x40ca5008 active tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
F 3 3476 3 00000001 00000003 11 512 A 1 44100 0 0 02B81400 413A52E0 00000000 0x400 8192
Normal mixer raw underrun counters: partial=0 empty=0
- 0 Effect Chains:
==============================================>
> adb shell dumbsys media.audio_flinger
Clients:
pid: 502
pid: 618
pid: 792
pid: 3476
Notification Clients:
pid: 125
pid: 502
pid: 618
pid: 792
pid: 1234 {com.facebook.katana}
pid: 3476 {com.rdio.android.mono:remote}
pid: 16019 {com.android.chrome}
Global session refs:
session pid count
6 792 1
11 3476 1
26 618 2
27 618 1
57 502 1
61 502 1
Hardware status: 0
Standby Time mSec: 3000
Output thread 0x40ca5008 internals
Normal frame count: 1024
last write occurred (msecs): 3416
total writes: 55612
delayed writes: 0
blocked in write: 0
suspend count: 0
mix buffer : 0x413a52e0
Fast track availMask=0x90
io handle: 2
TID: 527
standby: 1
Sample rate: 44100
HAL frame count: 512
Channel Count: 2
Channel Mask: 0x00000003
Format: 1
Frame size: 4
Pending setParameters commands:
Index Command
Pending config events:
AudioMixer tracks: 00000077
FastMixer command=COLD_IDLE writeSequence=222508 framesWritten=56957440
numTracks=1 writeErrors=9 underruns=1 overruns=25
sampleRate=44100 frameCount=512 measuredWarmup=78.6 ms, warmupCycles=4
mixPeriod=11.61 ms
Simple moving statistics over last 380.4 seconds:
wall clock time in ms per mix cycle:
mean=11.61 min=0.05 max=147.97 stddev=0.84
raw CPU load in us per mix cycle:
mean=297 min=0 max=6516 stddev=124
Distribution of mix cycle times in ms for the tails (> ~3 stddev outliers):
left tail: mean=3.06 min=0.05 max=8.02 stddev=3.06
right tail: mean=19.73 min=14.26 max=147.97 stddev=23.45
Fast tracks: kMaxFastTracks=8 activeMask=0x1
Index Active Full Partial Empty Recent Ready
0 yes 630 0 0 full 1536
1 no 0 0 0 full 0
2 no 32 2 5 empty 0
3 no 130 0 55 empty 0
4 no 137 17 54 empty 0
5 no 140 16 55 empty 0
6 no 14 2 6 empty 0
7 no 0 0 0 full 0
Output thread 0x40ca5008 stream volumes in dB:
0:-8.2, 1:-27, 2:-21, 3:-14, 4:-14, 5:-21, 6:0, 7:-27, 8:-22, 9:-14
Output thread 0x40ca5008 tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
F 1 792 0 00000001 00000001 6 512 I 0 44100 -10 -10 00000000 413A52E0 00000000 0x000 0
F 2 618 1 00000001 00000003 27 8329 S 1 44100 -Inf -Inf 00002089 413A52E0 00000000 0x600 0
F 6 502 1 00000001 00000003 61 4146 S 1 44100 -Inf -Inf 00001032 413A52E0 00000000 0x600 0
F 5 502 1 00000001 00000003 57 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
1 618 5 00000001 00000003 26 4096 S 1 44100 0 0 0000F800 413A52E0 00000000 0x400 1024
F 3 3476 3 00000001 00000003 11 512 I 1 44100 0 0 0348F600 413A52E0 00000000 0x601 26624
Output thread 0x40ca5008 active tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
Normal mixer raw underrun counters: partial=0 empty=0
- 0 Effect Chains:
==============================================>
> adb shell dumbsys media.audio_flinger
Clients:
pid: 502
pid: 618
pid: 792
pid: 3476
Notification Clients:
pid: 125
pid: 502
pid: 618
pid: 792
pid: 1234
pid: 3476
pid: 16019
Global session refs:
session pid count
6 792 1
11 3476 1
26 618 2
27 618 1
89 502 1
90 502 1
91 502 1
92 502 1
Hardware status: 0
Standby Time mSec: 3000
Output thread 0x40ca5008 internals
Normal frame count: 1024
last write occurred (msecs): 12
total writes: 61853
delayed writes: 0
blocked in write: 1
suspend count: 0
mix buffer : 0x413a52e0
Fast track availMask=0x80
io handle: 2
TID: 527
standby: 0
Sample rate: 44100
HAL frame count: 512
Channel Count: 2
Channel Mask: 0x00000003
Format: 1
Frame size: 4
Pending setParameters commands:
Index Command
Pending config events:
AudioMixer tracks: 0000017f
FastMixer command=MIX_WRITE writeSequence=247489 framesWritten=63351808
numTracks=2 writeErrors=10 underruns=1 overruns=29
sampleRate=44100 frameCount=512 measuredWarmup=16.8 ms, warmupCycles=4
mixPeriod=11.61 ms
Simple moving statistics over last 141.8 seconds:
wall clock time in ms per mix cycle:
mean=11.61 min=0.07 max=17.45 stddev=0.34
raw CPU load in us per mix cycle:
mean=306 min=0 max=3498 stddev=149
Distribution of mix cycle times in ms for the tails (> ~3 stddev outliers):
left tail: mean=5.39 min=0.07 max=8.21 stddev=3.21
right tail: mean=15.83 min=14.89 max=17.45 stddev=0.95
Fast tracks: kMaxFastTracks=8 activeMask=0x9
Index Active Full Partial Empty Recent Ready
0 yes 825 0 0 full 2048
1 no 0 0 0 full 0
2 no 32 2 5 empty 0
3 yes 649 0 62 full 512
4 no 230 28 81 empty 0
5 no 181 21 69 empty 0
6 no 89 11 30 empty 0
7 no 36 4 8 empty 0
Output thread 0x40ca5008 stream volumes in dB:
0:-8.2, 1:-27, 2:-21, 3:-14, 4:-14, 5:-21, 6:0, 7:-27, 8:-22, 9:-14
Output thread 0x40ca5008 tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
F 6 502 1 00000001 00000003 90 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
F 1 792 0 00000001 00000001 6 512 I 0 44100 -10 -10 00000000 413A52E0 00000000 0x000 0
8 502 1 00000001 00000003 89 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
F 2 618 1 00000001 00000003 27 8329 S 1 44100 -Inf -Inf 00002089 413A52E0 00000000 0x600 0
F 4 502 1 00000001 00000003 91 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
1 618 5 00000001 00000003 26 4096 S 1 44100 0 0 0000F800 413A52E0 00000000 0x400 1024
F 5 502 1 00000001 00000003 92 3101 S 1 44100 -Inf -Inf 00000C1D 413A52E0 00000000 0x600 0
F 3 3476 3 00000001 00000003 11 512 A 1 44100 0 0 03A50400 413A52E0 00000000 0x400 29696
Output thread 0x40ca5008 active tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
F 3 3476 3 00000001 00000003 11 512 A 1 44100 0 0 03A50400 413A52E0 00000000 0x400 29696
Normal mixer raw underrun counters: partial=0 empty=0
- 0 Effect Chains:
==============================================>
> adb shell dumbsys media.audio_flinger
Clients:
pid: 502
pid: 618
pid: 792
pid: 3476
Notification Clients:
pid: 125
pid: 502
pid: 618
pid: 792
pid: 1234
pid: 3476
pid: 16019
pid: 20027
Global session refs:
session pid count
6 792 1
11 3476 1
27 618 1
89 502 1
90 502 1
91 502 1
105 20027 1
106 20027 1
107 502 1
Hardware status: 0
Standby Time mSec: 3000
Output thread 0x40ca5008 internals
Normal frame count: 1024
last write occurred (msecs): 11
total writes: 100575
delayed writes: 0
blocked in write: 1
suspend count: 0
mix buffer : 0x413a52e0
Fast track availMask=0x20
io handle: 2
TID: 527
standby: 0
Sample rate: 44100
HAL frame count: 512
Channel Count: 2
Channel Mask: 0x00000003
Format: 1
Frame size: 4
Pending setParameters commands:
Index Command
Pending config events:
AudioMixer tracks: 0000016f
FastMixer command=MIX_WRITE writeSequence=402391 framesWritten=103004672
numTracks=2 writeErrors=14 underruns=6 overruns=38
sampleRate=44100 frameCount=512 measuredWarmup=13.5 ms, warmupCycles=4
mixPeriod=11.61 ms
Simple moving statistics over last 305.7 seconds:
wall clock time in ms per mix cycle:
mean=11.61 min=0.04 max=23.41 stddev=0.25
raw CPU load in us per mix cycle:
mean=326 min=0 max=8394 stddev=126
Distribution of mix cycle times in ms for the tails (> ~3 stddev outliers):
left tail: mean=7.13 min=0.04 max=9.29 stddev=3.40
right tail: mean=14.77 min=13.77 max=23.41 stddev=1.88
Fast tracks: kMaxFastTracks=8 activeMask=0x9
Index Active Full Partial Empty Recent Ready
0 yes 445 0 3 full 2048
1 no 0 0 0 full 0
2 no 32 2 5 empty 0
3 yes 602 0 85 full 512
4 no 230 28 81 empty 0
5 no 229 27 89 empty 0
6 no 89 11 30 empty 0
7 no 92 11 31 empty 0
Output thread 0x40ca5008 stream volumes in dB:
0:-8.2, 1:-27, 2:-21, 3:-14, 4:-14, 5:-21, 6:0, 7:-27, 8:-22, 9:-14
Output thread 0x40ca5008 tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
F 6 502 1 00000001 00000003 90 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
F 1 792 0 00000001 00000001 6 512 I 0 44100 -10 -10 00000000 413A52E0 00000000 0x000 0
8 502 1 00000001 00000003 89 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
F 2 618 1 00000001 00000003 27 8329 S 1 44100 -Inf -Inf 00002089 413A52E0 00000000 0x600 0
F 7 502 1 00000001 00000003 107 4146 S 1 44100 -Inf -Inf 00001032 413A52E0 00000000 0x600 0
F 4 502 1 00000001 00000003 91 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
F 3 3476 3 00000001 00000003 11 512 A 1 44100 0 0 05FC9E00 413A52E0 00000000 0x400 39424
Output thread 0x40ca5008 active tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
F 3 3476 3 00000001 00000003 11 512 A 1 44100 0 0 05FC9E00 413A52E0 00000000 0x400 39424
Normal mixer raw underrun counters: partial=0 empty=3
- 0 Effect Chains:
==============================================>
> adb shell dumbsys media.audio_flinger
Clients:
pid: 502
pid: 618
pid: 792
pid: 3476
Notification Clients:
pid: 125
pid: 502
pid: 618
pid: 792
pid: 1234
pid: 3476
pid: 16019
pid: 20027
Global session refs:
session pid count
6 792 1
11 3476 1
27 618 1
89 502 1
90 502 1
91 502 1
105 20027 1
106 20027 1
117 502 1
118 618 2
Hardware status: 0
Standby Time mSec: 3000
Output thread 0x40ca5008 internals
Normal frame count: 1024
last write occurred (msecs): 11
total writes: 127838
delayed writes: 0
blocked in write: 1
suspend count: 0
mix buffer : 0x413a52e0
Fast track availMask=0x20
io handle: 2
TID: 527
standby: 0
Sample rate: 44100
HAL frame count: 512
Channel Count: 2
Channel Mask: 0x00000003
Format: 1
Frame size: 4
Pending setParameters commands:
Index Command
Pending config events:
AudioMixer tracks: 0000017f
FastMixer command=MIX_WRITE writeSequence=511459 framesWritten=130924032
numTracks=2 writeErrors=18 underruns=8 overruns=47
sampleRate=44100 frameCount=512 measuredWarmup=80.7 ms, warmupCycles=4
mixPeriod=11.61 ms
Simple moving statistics over last 380.4 seconds:
wall clock time in ms per mix cycle:
mean=11.61 min=0.08 max=19.42 stddev=0.17
raw CPU load in us per mix cycle:
mean=332 min=64 max=1356 stddev=110
Distribution of mix cycle times in ms for the tails (> ~3 stddev outliers):
left tail: mean=8.97 min=0.08 max=10.46 stddev=2.50
right tail: mean=13.60 min=12.72 max=19.42 stddev=1.26
Fast tracks: kMaxFastTracks=8 activeMask=0x9
Index Active Full Partial Empty Recent Ready
0 yes 699 0 3 full 2048
1 no 0 0 0 full 0
2 no 32 2 5 empty 0
3 yes 889 0 109 full 512
4 no 230 28 81 empty 0
5 no 269 32 104 empty 0
6 no 89 11 30 empty 0
7 no 132 16 44 empty 0
Output thread 0x40ca5008 stream volumes in dB:
0:-8.2, 1:-27, 2:-21, 3:-14, 4:-14, 5:-21, 6:0, 7:-27, 8:-22, 9:-14
Output thread 0x40ca5008 tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
F 6 502 1 00000001 00000003 90 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
F 1 792 0 00000001 00000001 6 512 I 0 44100 -10 -10 00000000 413A52E0 00000000 0x000 0
8 502 1 00000001 00000003 89 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
F 2 618 1 00000001 00000003 27 8329 S 1 44100 -Inf -Inf 00002089 413A52E0 00000000 0x600 0
F 7 502 1 00000001 00000003 117 4146 S 1 44100 -Inf -Inf 00001032 413A52E0 00000000 0x600 0
F 4 502 1 00000001 00000003 91 4786 S 1 44100 -Inf -Inf 000012B2 413A52E0 00000000 0x600 0
4 618 5 00000001 00000003 118 4096 S 1 44100 0 0 0000F800 413A52E0 00000000 0x400 0
F 3 3476 3 00000001 00000003 11 512 A 1 44100 0 0 079ED800 413A52E0 00000000 0x400 50688
Output thread 0x40ca5008 active tracks
Name Client Type Fmt Chn mask Session fCount S F SRate L dB R dB Server Main buf Aux Buf Flags UndFrmCnt
F 3 3476 3 00000001 00000003 11 512 A 1 44100 0 0 079ED800 413A52E0 00000000 0x400 50688
Normal mixer raw underrun counters: partial=0 empty=3
- 0 Effect Chains:
...<p style="margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: 'C