Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java

Issue 2670473004: Remove InlinedApi lint ignore. (Closed)
Patch Set: Immersive sticky only requires Kitkat not Lollipop. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 package org.webrtc.voiceengine; 11 package org.webrtc.voiceengine;
12 12
13 import org.webrtc.Logging;
14
15 import android.annotation.TargetApi; 13 import android.annotation.TargetApi;
16 import android.content.Context; 14 import android.content.Context;
17 import android.content.pm.PackageManager; 15 import android.content.pm.PackageManager;
18 import android.media.AudioFormat; 16 import android.media.AudioFormat;
19 import android.media.AudioManager; 17 import android.media.AudioManager;
20 import android.media.AudioRecord; 18 import android.media.AudioRecord;
21 import android.media.AudioTrack; 19 import android.media.AudioTrack;
22 import android.os.Build; 20 import android.os.Build;
23
24 import java.util.Timer; 21 import java.util.Timer;
25 import java.util.TimerTask; 22 import java.util.TimerTask;
23 import org.webrtc.Logging;
26 24
27 // WebRtcAudioManager handles tasks that uses android.media.AudioManager. 25 // WebRtcAudioManager handles tasks that uses android.media.AudioManager.
28 // At construction, storeAudioParameters() is called and it retrieves 26 // At construction, storeAudioParameters() is called and it retrieves
29 // fundamental audio parameters like native sample rate and number of channels. 27 // fundamental audio parameters like native sample rate and number of channels.
30 // The result is then provided to the caller by nativeCacheAudioParameters(). 28 // The result is then provided to the caller by nativeCacheAudioParameters().
31 // It is also possible to call init() to set up the audio environment for best 29 // It is also possible to call init() to set up the audio environment for best
32 // possible "VoIP performance". All settings done in init() are reverted by 30 // possible "VoIP performance". All settings done in init() are reverted by
33 // dispose(). This class can also be used without calling init() if the user 31 // dispose(). This class can also be used without calling init() if the user
34 // prefers to set up the audio environment separately. However, it is 32 // prefers to set up the audio environment separately. However, it is
35 // recommended to always use AudioManager.MODE_IN_COMMUNICATION. 33 // recommended to always use AudioManager.MODE_IN_COMMUNICATION.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 public boolean isLowLatencyInputSupported() { 239 public boolean isLowLatencyInputSupported() {
242 // TODO(henrika): investigate if some sort of device list is needed here 240 // TODO(henrika): investigate if some sort of device list is needed here
243 // as well. The NDK doc states that: "As of API level 21, lower latency 241 // as well. The NDK doc states that: "As of API level 21, lower latency
244 // audio input is supported on select devices. To take advantage of this 242 // audio input is supported on select devices. To take advantage of this
245 // feature, first confirm that lower latency output is available". 243 // feature, first confirm that lower latency output is available".
246 return WebRtcAudioUtils.runningOnLollipopOrHigher() && isLowLatencyOutputSup ported(); 244 return WebRtcAudioUtils.runningOnLollipopOrHigher() && isLowLatencyOutputSup ported();
247 } 245 }
248 246
249 // Returns true if the device has professional audio level of functionality 247 // Returns true if the device has professional audio level of functionality
250 // and therefore supports the lowest possible round-trip latency. 248 // and therefore supports the lowest possible round-trip latency.
249 @TargetApi(23)
251 private boolean isProAudioSupported() { 250 private boolean isProAudioSupported() {
252 return WebRtcAudioUtils.runningOnMarshmallowOrHigher() 251 return WebRtcAudioUtils.runningOnMarshmallowOrHigher()
253 && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_A UDIO_PRO); 252 && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_A UDIO_PRO);
254 } 253 }
255 254
256 // Returns the native output sample rate for this device's output stream. 255 // Returns the native output sample rate for this device's output stream.
257 private int getNativeOutputSampleRate() { 256 private int getNativeOutputSampleRate() {
258 // Override this if we're running on an old emulator image which only 257 // Override this if we're running on an old emulator image which only
259 // supports 8 kHz and doesn't support PROPERTY_OUTPUT_SAMPLE_RATE. 258 // supports 8 kHz and doesn't support PROPERTY_OUTPUT_SAMPLE_RATE.
260 if (WebRtcAudioUtils.runningOnEmulator()) { 259 if (WebRtcAudioUtils.runningOnEmulator()) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 if (!condition) { 352 if (!condition) {
354 throw new AssertionError("Expected condition to be true"); 353 throw new AssertionError("Expected condition to be true");
355 } 354 }
356 } 355 }
357 356
358 private native void nativeCacheAudioParameters(int sampleRate, int outputChann els, 357 private native void nativeCacheAudioParameters(int sampleRate, int outputChann els,
359 int inputChannels, boolean hardwareAEC, boolean hardwareAGC, boolean hardw areNS, 358 int inputChannels, boolean hardwareAEC, boolean hardwareAGC, boolean hardw areNS,
360 boolean lowLatencyOutput, boolean lowLatencyInput, boolean proAudio, int o utputBufferSize, 359 boolean lowLatencyOutput, boolean lowLatencyInput, boolean proAudio, int o utputBufferSize,
361 int inputBufferSize, long nativeAudioManager); 360 int inputBufferSize, long nativeAudioManager);
362 } 361 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698