Use low latency mode on Android O and later.
This CL makes it possible to use a low-latency mode on Android O and later. This should help to reduce the audio latency. The feature is disabled by default and needs to be enabled when creating the audio device module. Bug: webrtc:12284 Change-Id: Idf41146aa0bc1206e9a2e28e4101d85c3e4eaefc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196741 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Commit-Queue: Ivo Creusen <ivoc@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32854}
This commit is contained in:
@ -151,6 +151,18 @@ int32_t AudioTrackJni::StopPlayout() {
|
||||
if (!initialized_ || !playing_) {
|
||||
return 0;
|
||||
}
|
||||
// Log the difference in initial and current buffer level.
|
||||
const int current_buffer_size_frames =
|
||||
Java_WebRtcAudioTrack_getBufferSizeInFrames(env_, j_audio_track_);
|
||||
const int initial_buffer_size_frames =
|
||||
Java_WebRtcAudioTrack_getInitialBufferSizeInFrames(env_, j_audio_track_);
|
||||
const int sample_rate_hz = audio_parameters_.sample_rate();
|
||||
RTC_HISTOGRAM_COUNTS(
|
||||
"WebRTC.Audio.AndroidNativeAudioBufferSizeDifferenceFromInitialMs",
|
||||
(current_buffer_size_frames - initial_buffer_size_frames) * 1000 /
|
||||
sample_rate_hz,
|
||||
-500, 100, 100);
|
||||
|
||||
if (!Java_WebRtcAudioTrack_stopPlayout(env_, j_audio_track_)) {
|
||||
RTC_LOG(LS_ERROR) << "StopPlayout failed";
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user