Loading core/jni/android_media_AudioSystem.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -271,6 +271,17 @@ android_media_AudioSystem_getPrimaryOutputFrameCount(JNIEnv *env, jobject clazz) return (jint) AudioSystem::getPrimaryOutputFrameCount(); } static jint android_media_AudioSystem_getOutputLatency(JNIEnv *env, jobject clazz, jint stream) { uint32_t afLatency; if (AudioSystem::getOutputLatency(&afLatency, static_cast <audio_stream_type_t>(stream)) != NO_ERROR) { afLatency = -1; } return (jint) afLatency; } // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { Loading @@ -296,6 +307,7 @@ static JNINativeMethod gMethods[] = { {"getDevicesForStream", "(I)I", (void *)android_media_AudioSystem_getDevicesForStream}, {"getPrimaryOutputSamplingRate", "()I", (void *)android_media_AudioSystem_getPrimaryOutputSamplingRate}, {"getPrimaryOutputFrameCount", "()I", (void *)android_media_AudioSystem_getPrimaryOutputFrameCount}, {"getOutputLatency", "(I)I", (void *)android_media_AudioSystem_getOutputLatency}, }; int register_android_media_AudioSystem(JNIEnv *env) Loading core/jni/android_media_AudioTrack.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -727,6 +727,19 @@ static jint android_media_AudioTrack_get_position(JNIEnv *env, jobject thiz) { } // ---------------------------------------------------------------------------- static jint android_media_AudioTrack_get_latency(JNIEnv *env, jobject thiz) { sp<AudioTrack> lpTrack = getAudioTrack(env, thiz); if (lpTrack == NULL) { jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioTrack pointer for latency()"); return AUDIOTRACK_ERROR; } return (jint)lpTrack->latency(); } // ---------------------------------------------------------------------------- static jint android_media_AudioTrack_set_loop(JNIEnv *env, jobject thiz, jint loopStart, jint loopEnd, jint loopCount) { Loading Loading @@ -854,6 +867,7 @@ static JNINativeMethod gMethods[] = { "()I", (void *)android_media_AudioTrack_get_pos_update_period}, {"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_set_loop", "(III)I", (void *)android_media_AudioTrack_set_loop}, {"native_reload_static", "()I", (void *)android_media_AudioTrack_reload}, {"native_get_output_sample_rate", Loading media/java/android/media/AudioManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -2553,4 +2553,15 @@ public class AudioManager { } } /** * Returns the estimated latency for the given stream type in milliseconds. * * DO NOT UNHIDE. The existing approach for doing A/V sync has too many problems. We need * a better solution. * @hide */ public int getOutputLatency(int streamType) { return AudioSystem.getOutputLatency(streamType); } } media/java/android/media/AudioSystem.java +1 −0 Original line number Diff line number Diff line Loading @@ -401,5 +401,6 @@ public class AudioSystem // helpers for android.media.AudioManager.getProperty(), see description there for meaning public static native int getPrimaryOutputSamplingRate(); public static native int getPrimaryOutputFrameCount(); public static native int getOutputLatency(int stream); } media/java/android/media/AudioTrack.java +14 −0 Original line number Diff line number Diff line Loading @@ -627,6 +627,18 @@ public class AudioTrack return native_get_position(); } /** * Returns this track's estimated latency in milliseconds. This includes the latency due * to AudioTrack buffer size, AudioMixer (if any) and audio hardware driver. * * DO NOT UNHIDE. The existing approach for doing A/V sync has too many problems. We need * a better solution. * @hide */ public int getLatency() { return native_get_latency(); } /** * Returns the hardware output sample rate */ Loading Loading @@ -1256,6 +1268,8 @@ public class AudioTrack private native final int native_set_position(int position); private native final int native_get_position(); private native final int native_get_latency(); private native final int native_set_loop(int start, int end, int loopCount); static private native final int native_get_output_sample_rate(int streamType); Loading Loading
core/jni/android_media_AudioSystem.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -271,6 +271,17 @@ android_media_AudioSystem_getPrimaryOutputFrameCount(JNIEnv *env, jobject clazz) return (jint) AudioSystem::getPrimaryOutputFrameCount(); } static jint android_media_AudioSystem_getOutputLatency(JNIEnv *env, jobject clazz, jint stream) { uint32_t afLatency; if (AudioSystem::getOutputLatency(&afLatency, static_cast <audio_stream_type_t>(stream)) != NO_ERROR) { afLatency = -1; } return (jint) afLatency; } // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { Loading @@ -296,6 +307,7 @@ static JNINativeMethod gMethods[] = { {"getDevicesForStream", "(I)I", (void *)android_media_AudioSystem_getDevicesForStream}, {"getPrimaryOutputSamplingRate", "()I", (void *)android_media_AudioSystem_getPrimaryOutputSamplingRate}, {"getPrimaryOutputFrameCount", "()I", (void *)android_media_AudioSystem_getPrimaryOutputFrameCount}, {"getOutputLatency", "(I)I", (void *)android_media_AudioSystem_getOutputLatency}, }; int register_android_media_AudioSystem(JNIEnv *env) Loading
core/jni/android_media_AudioTrack.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -727,6 +727,19 @@ static jint android_media_AudioTrack_get_position(JNIEnv *env, jobject thiz) { } // ---------------------------------------------------------------------------- static jint android_media_AudioTrack_get_latency(JNIEnv *env, jobject thiz) { sp<AudioTrack> lpTrack = getAudioTrack(env, thiz); if (lpTrack == NULL) { jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioTrack pointer for latency()"); return AUDIOTRACK_ERROR; } return (jint)lpTrack->latency(); } // ---------------------------------------------------------------------------- static jint android_media_AudioTrack_set_loop(JNIEnv *env, jobject thiz, jint loopStart, jint loopEnd, jint loopCount) { Loading Loading @@ -854,6 +867,7 @@ static JNINativeMethod gMethods[] = { "()I", (void *)android_media_AudioTrack_get_pos_update_period}, {"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_set_loop", "(III)I", (void *)android_media_AudioTrack_set_loop}, {"native_reload_static", "()I", (void *)android_media_AudioTrack_reload}, {"native_get_output_sample_rate", Loading
media/java/android/media/AudioManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -2553,4 +2553,15 @@ public class AudioManager { } } /** * Returns the estimated latency for the given stream type in milliseconds. * * DO NOT UNHIDE. The existing approach for doing A/V sync has too many problems. We need * a better solution. * @hide */ public int getOutputLatency(int streamType) { return AudioSystem.getOutputLatency(streamType); } }
media/java/android/media/AudioSystem.java +1 −0 Original line number Diff line number Diff line Loading @@ -401,5 +401,6 @@ public class AudioSystem // helpers for android.media.AudioManager.getProperty(), see description there for meaning public static native int getPrimaryOutputSamplingRate(); public static native int getPrimaryOutputFrameCount(); public static native int getOutputLatency(int stream); }
media/java/android/media/AudioTrack.java +14 −0 Original line number Diff line number Diff line Loading @@ -627,6 +627,18 @@ public class AudioTrack return native_get_position(); } /** * Returns this track's estimated latency in milliseconds. This includes the latency due * to AudioTrack buffer size, AudioMixer (if any) and audio hardware driver. * * DO NOT UNHIDE. The existing approach for doing A/V sync has too many problems. We need * a better solution. * @hide */ public int getLatency() { return native_get_latency(); } /** * Returns the hardware output sample rate */ Loading Loading @@ -1256,6 +1268,8 @@ public class AudioTrack private native final int native_set_position(int position); private native final int native_get_position(); private native final int native_get_latency(); private native final int native_set_loop(int start, int end, int loopCount); static private native final int native_get_output_sample_rate(int streamType); Loading