Add UMA histogram for native audio buffer size in ms

The Android native audio code asks the OS to provide an appropriate
buffer size for real-time audio playout. We should add logging for this
value so we can see what values are used in practice.

Bug: b/157429867
Change-Id: I111a74faefc0e77b5c98921804d6625cba1b84af
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176126
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreasson <henrika@chromium.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31368}
This commit is contained in:
Ivo Creusen
2020-05-27 13:41:25 +02:00
committed by Commit Bot
parent 63673fe2cc
commit bdb5830d69
3 changed files with 26 additions and 15 deletions

View File

@ -183,7 +183,7 @@ class WebRtcAudioTrack {
}
@CalledByNative
private boolean initPlayout(int sampleRate, int channels, double bufferSizeFactor) {
private int initPlayout(int sampleRate, int channels, double bufferSizeFactor) {
threadChecker.checkIsOnValidThread();
Logging.d(TAG,
"initPlayout(sampleRate=" + sampleRate + ", channels=" + channels
@ -212,14 +212,14 @@ class WebRtcAudioTrack {
// can happen that |minBufferSizeInBytes| contains an invalid value.
if (minBufferSizeInBytes < byteBuffer.capacity()) {
reportWebRtcAudioTrackInitError("AudioTrack.getMinBufferSize returns an invalid value.");
return false;
return -1;
}
// Ensure that prevision audio session was stopped correctly before trying
// to create a new AudioTrack.
if (audioTrack != null) {
reportWebRtcAudioTrackInitError("Conflict with existing AudioTrack.");
return false;
return -1;
}
try {
// Create an AudioTrack object and initialize its associated audio buffer.
@ -241,7 +241,7 @@ class WebRtcAudioTrack {
} catch (IllegalArgumentException e) {
reportWebRtcAudioTrackInitError(e.getMessage());
releaseAudioResources();
return false;
return -1;
}
// It can happen that an AudioTrack is created but it was not successfully
@ -250,11 +250,11 @@ class WebRtcAudioTrack {
if (audioTrack == null || audioTrack.getState() != AudioTrack.STATE_INITIALIZED) {
reportWebRtcAudioTrackInitError("Initialization of audio track failed.");
releaseAudioResources();
return false;
return -1;
}
logMainParameters();
logMainParametersExtended();
return true;
return minBufferSizeInBytes;
}
@CalledByNative