AudioTrack: make low latency APIs public
Allow apps to lower their Java audio latency.
Bug: 21019153
Change-Id: I1be9a083c46e9fcf7db2635e813cab13dbad810a
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/api/current.txt b/api/current.txt
index bfbb17e..c1cd920 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -19209,6 +19209,7 @@
field public static final android.os.Parcelable.Creator<android.media.AudioAttributes> CREATOR;
field public static final int FLAG_AUDIBILITY_ENFORCED = 1; // 0x1
field public static final int FLAG_HW_AV_SYNC = 16; // 0x10
+ field public static final int FLAG_LOW_LATENCY = 256; // 0x100
field public static final int USAGE_ALARM = 4; // 0x4
field public static final int USAGE_ASSISTANCE_ACCESSIBILITY = 11; // 0xb
field public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12; // 0xc
@@ -19606,6 +19607,7 @@
method public void flush();
method public int getAudioFormat();
method public int getAudioSessionId();
+ method public int getBufferCapacityInFrames();
method public int getBufferSizeInFrames();
method public int getChannelConfiguration();
method public int getChannelCount();
@@ -19627,6 +19629,7 @@
method public int getState();
method public int getStreamType();
method public boolean getTimestamp(android.media.AudioTimestamp);
+ method public int getUnderrunCount();
method public void pause() throws java.lang.IllegalStateException;
method public void play() throws java.lang.IllegalStateException;
method public void release();
@@ -19634,6 +19637,7 @@
method public deprecated void removeOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener);
method public void removeOnRoutingListener(android.media.AudioRouting.OnRoutingChangedListener);
method public int setAuxEffectSendLevel(float);
+ method public int setBufferSizeInFrames(int);
method public int setLoopPoints(int, int, int);
method public int setNotificationMarkerPosition(int);
method public int setPlaybackHeadPosition(int);
diff --git a/api/system-current.txt b/api/system-current.txt
index c10954c..8a41349 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -20534,6 +20534,7 @@
field public static final int FLAG_BYPASS_MUTE = 128; // 0x80
field public static final int FLAG_HW_AV_SYNC = 16; // 0x10
field public static final int FLAG_HW_HOTWORD = 32; // 0x20
+ field public static final int FLAG_LOW_LATENCY = 256; // 0x100
field public static final int USAGE_ALARM = 4; // 0x4
field public static final int USAGE_ASSISTANCE_ACCESSIBILITY = 11; // 0xb
field public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12; // 0xc
@@ -20957,6 +20958,7 @@
method public void flush();
method public int getAudioFormat();
method public int getAudioSessionId();
+ method public int getBufferCapacityInFrames();
method public int getBufferSizeInFrames();
method public int getChannelConfiguration();
method public int getChannelCount();
@@ -20978,6 +20980,7 @@
method public int getState();
method public int getStreamType();
method public boolean getTimestamp(android.media.AudioTimestamp);
+ method public int getUnderrunCount();
method public void pause() throws java.lang.IllegalStateException;
method public void play() throws java.lang.IllegalStateException;
method public void release();
@@ -20985,6 +20988,7 @@
method public deprecated void removeOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener);
method public void removeOnRoutingListener(android.media.AudioRouting.OnRoutingChangedListener);
method public int setAuxEffectSendLevel(float);
+ method public int setBufferSizeInFrames(int);
method public int setLoopPoints(int, int, int);
method public int setNotificationMarkerPosition(int);
method public int setPlaybackHeadPosition(int);
diff --git a/api/test-current.txt b/api/test-current.txt
index c076ad6..169bb613 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -19217,6 +19217,7 @@
field public static final android.os.Parcelable.Creator<android.media.AudioAttributes> CREATOR;
field public static final int FLAG_AUDIBILITY_ENFORCED = 1; // 0x1
field public static final int FLAG_HW_AV_SYNC = 16; // 0x10
+ field public static final int FLAG_LOW_LATENCY = 256; // 0x100
field public static final int USAGE_ALARM = 4; // 0x4
field public static final int USAGE_ASSISTANCE_ACCESSIBILITY = 11; // 0xb
field public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12; // 0xc
@@ -19614,6 +19615,7 @@
method public void flush();
method public int getAudioFormat();
method public int getAudioSessionId();
+ method public int getBufferCapacityInFrames();
method public int getBufferSizeInFrames();
method public int getChannelConfiguration();
method public int getChannelCount();
@@ -19635,6 +19637,7 @@
method public int getState();
method public int getStreamType();
method public boolean getTimestamp(android.media.AudioTimestamp);
+ method public int getUnderrunCount();
method public void pause() throws java.lang.IllegalStateException;
method public void play() throws java.lang.IllegalStateException;
method public void release();
@@ -19642,6 +19645,7 @@
method public deprecated void removeOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener);
method public void removeOnRoutingListener(android.media.AudioRouting.OnRoutingChangedListener);
method public int setAuxEffectSendLevel(float);
+ method public int setBufferSizeInFrames(int);
method public int setLoopPoints(int, int, int);
method public int setNotificationMarkerPosition(int);
method public int setPlaybackHeadPosition(int);
diff --git a/media/java/android/media/AudioAttributes.java b/media/java/android/media/AudioAttributes.java
index efae628..c194711 100644
--- a/media/java/android/media/AudioAttributes.java
+++ b/media/java/android/media/AudioAttributes.java
@@ -224,7 +224,6 @@
public final static int FLAG_BYPASS_MUTE = 0x1 << 7;
/**
- * @hide
* Flag requesting a low latency path.
* When using this flag, the sample rate must match the native sample rate
* of the device. Effects processing is also unavailable.
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 4319840..3007d86 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -1100,7 +1100,6 @@
* @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
* {@link #ERROR_INVALID_OPERATION}
* @throws IllegalStateException
- * @hide
*/
public int setBufferSizeInFrames(int bufferSizeInFrames) {
if (mDataLoadMode == MODE_STATIC || mState == STATE_UNINITIALIZED) {
@@ -1130,7 +1129,6 @@
* {@link AudioManager#PROPERTY_OUTPUT_FRAMES_PER_BUFFER}.
* @return maximum size in frames of the <code>AudioTrack</code> buffer.
* @throws IllegalStateException
- * @hide
*/
public int getBufferCapacityInFrames() {
return native_get_buffer_capacity_frames();
@@ -1204,7 +1202,6 @@
* This is a continuously advancing counter. It can wrap around to zero
* if there are too many underruns. If there were, for example, 68 underruns per
* second then the counter would wrap in 2 years.
- * @hide
*/
public int getUnderrunCount() {
return native_get_underrun_count();