am d9f4e0cf: Merge "AudioTrack.getTimestamp() return type is now boolean" into klp-dev
* commit 'd9f4e0cf2c2466d9e05f8562e55d342934f7ed0d': AudioTrack.getTimestamp() return type is now boolean
This commit is contained in:
@@ -12172,7 +12172,7 @@ package android.media {
|
|||||||
method public int getSampleRate();
|
method public int getSampleRate();
|
||||||
method public int getState();
|
method public int getState();
|
||||||
method public int getStreamType();
|
method public int getStreamType();
|
||||||
method public android.media.AudioTimestamp getTimestamp(android.media.AudioTimestamp);
|
method public boolean getTimestamp(android.media.AudioTimestamp);
|
||||||
method public void pause() throws java.lang.IllegalStateException;
|
method public void pause() throws java.lang.IllegalStateException;
|
||||||
method public void play() throws java.lang.IllegalStateException;
|
method public void play() throws java.lang.IllegalStateException;
|
||||||
method public void release();
|
method public void release();
|
||||||
|
|||||||
@@ -746,31 +746,28 @@ public class AudioTrack
|
|||||||
* If you need such features, consider implementing them at application level.
|
* If you need such features, consider implementing them at application level.
|
||||||
*
|
*
|
||||||
* @param timestamp a reference to a non-null AudioTimestamp instance allocated
|
* @param timestamp a reference to a non-null AudioTimestamp instance allocated
|
||||||
* and owned by caller, or null.
|
* and owned by caller.
|
||||||
* @return that same instance if timestamp parameter is non-null and a timestamp is available,
|
* @return true if a timestamp is available, or false if no timestamp is available.
|
||||||
* or a reference to a new AudioTimestamp instance which is now owned by caller
|
* If a timestamp if available,
|
||||||
* if timestamp parameter is null and a timestamp is available,
|
|
||||||
* or null if no timestamp is available. In either successful case,
|
|
||||||
* the AudioTimestamp instance is filled in with a position in frame units, together
|
* the AudioTimestamp instance is filled in with a position in frame units, together
|
||||||
* with the estimated time when that frame was presented or is committed to
|
* with the estimated time when that frame was presented or is committed to
|
||||||
* be presented.
|
* be presented.
|
||||||
* In the case that no timestamp is available, any supplied instance is left unaltered.
|
* In the case that no timestamp is available, any supplied instance is left unaltered.
|
||||||
*/
|
*/
|
||||||
public AudioTimestamp getTimestamp(AudioTimestamp timestamp)
|
public boolean getTimestamp(AudioTimestamp timestamp)
|
||||||
{
|
{
|
||||||
|
if (timestamp == null) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
// It's unfortunate, but we have to either create garbage every time or use synchronized
|
// It's unfortunate, but we have to either create garbage every time or use synchronized
|
||||||
long[] longArray = new long[2];
|
long[] longArray = new long[2];
|
||||||
int ret = native_get_timestamp(longArray);
|
int ret = native_get_timestamp(longArray);
|
||||||
if (ret == SUCCESS) {
|
if (ret != SUCCESS) {
|
||||||
if (timestamp == null) {
|
return false;
|
||||||
timestamp = new AudioTimestamp();
|
|
||||||
}
|
|
||||||
timestamp.framePosition = longArray[0];
|
|
||||||
timestamp.nanoTime = longArray[1];
|
|
||||||
} else {
|
|
||||||
timestamp = null;
|
|
||||||
}
|
}
|
||||||
return timestamp;
|
timestamp.framePosition = longArray[0];
|
||||||
|
timestamp.nanoTime = longArray[1];
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user