Loading core/jni/android_media_AudioTrack.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -1419,6 +1419,16 @@ static jint android_media_AudioTrack_getDualMonoMode(JNIEnv *env, jobject thiz, return nativeToJavaStatus(status); } static void android_media_AudioTrack_setPlayerIId(JNIEnv *env, jobject thiz, jint playerIId) { sp<AudioTrack> track = getAudioTrack(env, thiz); if (track == nullptr) { jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioTrack pointer for setPlayerIId()"); } ALOGV("%s: playerIId %d", __func__, playerIId); track->setPlayerIId(playerIId); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- static const JNINativeMethod gMethods[] = { Loading Loading @@ -1496,6 +1506,7 @@ static const JNINativeMethod gMethods[] = { (void *)android_media_AudioTrack_getAudioDescriptionMixLeveldB}, {"native_set_dual_mono_mode", "(I)I", (void *)android_media_AudioTrack_setDualMonoMode}, {"native_get_dual_mono_mode", "([I)I", (void *)android_media_AudioTrack_getDualMonoMode}, {"native_setPlayerIId", "(I)V", (void *)android_media_AudioTrack_setPlayerIId}, }; // field names found in android/media/AudioTrack.java Loading media/java/android/media/AudioTrack.java +15 −0 Original line number Diff line number Diff line Loading @@ -837,6 +837,7 @@ public class AudioTrack extends PlayerBase } baseRegisterPlayer(mSessionId); native_setPlayerIId(mPlayerIId); // mPlayerIId now ready to send to native AudioTrack. } /** Loading Loading @@ -4203,6 +4204,20 @@ public class AudioTrack extends PlayerBase private native int native_set_dual_mono_mode(int dualMonoMode); private native int native_get_dual_mono_mode(int[] dualMonoMode); /** * Sets the audio service Player Interface Id. * * The playerIId does not change over the lifetime of the client * Java AudioTrack and is set automatically on creation. * * This call informs the native AudioTrack for metrics logging purposes. * * @param id the value reported by AudioManager when registering the track. * A value of -1 indicates invalid - the playerIId was never set. * @throws IllegalStateException if AudioTrack not initialized. */ private native void native_setPlayerIId(int playerIId); //--------------------------------------------------------- // Utility methods //------------------ Loading media/java/android/media/PlayerBase.java +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ public abstract class PlayerBase { private final int mImplType; // uniquely identifies the Player Interface throughout the system (P I Id) private int mPlayerIId = AudioPlaybackConfiguration.PLAYER_PIID_INVALID; protected int mPlayerIId = AudioPlaybackConfiguration.PLAYER_PIID_INVALID; @GuardedBy("mLock") private int mState; Loading Loading
core/jni/android_media_AudioTrack.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -1419,6 +1419,16 @@ static jint android_media_AudioTrack_getDualMonoMode(JNIEnv *env, jobject thiz, return nativeToJavaStatus(status); } static void android_media_AudioTrack_setPlayerIId(JNIEnv *env, jobject thiz, jint playerIId) { sp<AudioTrack> track = getAudioTrack(env, thiz); if (track == nullptr) { jniThrowException(env, "java/lang/IllegalStateException", "Unable to retrieve AudioTrack pointer for setPlayerIId()"); } ALOGV("%s: playerIId %d", __func__, playerIId); track->setPlayerIId(playerIId); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- static const JNINativeMethod gMethods[] = { Loading Loading @@ -1496,6 +1506,7 @@ static const JNINativeMethod gMethods[] = { (void *)android_media_AudioTrack_getAudioDescriptionMixLeveldB}, {"native_set_dual_mono_mode", "(I)I", (void *)android_media_AudioTrack_setDualMonoMode}, {"native_get_dual_mono_mode", "([I)I", (void *)android_media_AudioTrack_getDualMonoMode}, {"native_setPlayerIId", "(I)V", (void *)android_media_AudioTrack_setPlayerIId}, }; // field names found in android/media/AudioTrack.java Loading
media/java/android/media/AudioTrack.java +15 −0 Original line number Diff line number Diff line Loading @@ -837,6 +837,7 @@ public class AudioTrack extends PlayerBase } baseRegisterPlayer(mSessionId); native_setPlayerIId(mPlayerIId); // mPlayerIId now ready to send to native AudioTrack. } /** Loading Loading @@ -4203,6 +4204,20 @@ public class AudioTrack extends PlayerBase private native int native_set_dual_mono_mode(int dualMonoMode); private native int native_get_dual_mono_mode(int[] dualMonoMode); /** * Sets the audio service Player Interface Id. * * The playerIId does not change over the lifetime of the client * Java AudioTrack and is set automatically on creation. * * This call informs the native AudioTrack for metrics logging purposes. * * @param id the value reported by AudioManager when registering the track. * A value of -1 indicates invalid - the playerIId was never set. * @throws IllegalStateException if AudioTrack not initialized. */ private native void native_setPlayerIId(int playerIId); //--------------------------------------------------------- // Utility methods //------------------ Loading
media/java/android/media/PlayerBase.java +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ public abstract class PlayerBase { private final int mImplType; // uniquely identifies the Player Interface throughout the system (P I Id) private int mPlayerIId = AudioPlaybackConfiguration.PLAYER_PIID_INVALID; protected int mPlayerIId = AudioPlaybackConfiguration.PLAYER_PIID_INVALID; @GuardedBy("mLock") private int mState; Loading