Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6256c5a authored by Phil Burk's avatar Phil Burk Committed by Android (Google) Code Review
Browse files

Merge "Revert "AudioTrack: Add getUnderrunCount()""

parents 172105e7 0ac70888
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -898,17 +898,6 @@ static jint android_media_AudioTrack_get_latency(JNIEnv *env, jobject thiz) {
    return (jint)lpTrack->latency();
}

// ----------------------------------------------------------------------------
static jint android_media_AudioTrack_get_underrun_count(JNIEnv *env,  jobject thiz) {
    sp<AudioTrack> lpTrack = getAudioTrack(env, thiz);

    if (lpTrack == NULL) {
        jniThrowException(env, "java/lang/IllegalStateException",
            "Unable to retrieve AudioTrack pointer for getUnderrunCount()");
        return (jint)AUDIO_JAVA_ERROR;
    }
    return (jint)lpTrack->getUnderrunCount();
}

// ----------------------------------------------------------------------------
static jint android_media_AudioTrack_get_timestamp(JNIEnv *env,  jobject thiz, jlongArray jTimestamp) {
@@ -1150,7 +1139,6 @@ static const JNINativeMethod gMethods[] = {
    {"native_set_position",  "(I)I",     (void *)android_media_AudioTrack_set_position},
    {"native_get_position",  "()I",      (void *)android_media_AudioTrack_get_position},
    {"native_get_latency",   "()I",      (void *)android_media_AudioTrack_get_latency},
    {"native_get_underrun_count", "()I",      (void *)android_media_AudioTrack_get_underrun_count},
    {"native_get_timestamp", "([J)I",    (void *)android_media_AudioTrack_get_timestamp},
    {"native_set_loop",      "(III)I",   (void *)android_media_AudioTrack_set_loop},
    {"native_reload_static", "()I",      (void *)android_media_AudioTrack_reload},
+1 −21
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.util.Log;

import com.android.internal.app.IAppOpsService;


/**
 * The AudioTrack class manages and plays a single audio resource for Java applications.
 * It allows streaming of PCM audio buffers to the audio sink for playback. This is
@@ -1185,25 +1186,6 @@ public class AudioTrack implements AudioRouting
        return native_get_latency();
    }

    /**
     * Returns the number of underrun occurrences in the application-level write buffer
     * since the AudioTrack was created.
     * An underrun occurs if the application does not write audio
     * data quickly enough, causing the buffer to underflow
     * and a potential audio glitch or pop.
     * Underruns are less likely when buffer sizes are large.
     * <p> Though the "int" type is signed 32-bits, the value should be reinterpreted
     * as if it is unsigned 32-bits.
     * That is, the next position after 0x7FFFFFFF is (int) 0x80000000.
     * 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();
    }

    /**
     *  Returns the output sample rate in Hz for the specified stream type.
     */
@@ -2797,8 +2779,6 @@ public class AudioTrack implements AudioRouting

    private native final int native_get_latency();

    private native final int native_get_underrun_count();

    // longArray must be a non-null array of length >= 2
    // [0] is assigned the frame position
    // [1] is assigned the time in CLOCK_MONOTONIC nanoseconds