Merge "MediaMetrics: Add LogSessionId" into sc-dev
This commit is contained in:
@@ -1419,6 +1419,18 @@ static jint android_media_AudioTrack_getDualMonoMode(JNIEnv *env, jobject thiz,
|
|||||||
return nativeToJavaStatus(status);
|
return nativeToJavaStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void android_media_AudioTrack_setLogSessionId(JNIEnv *env, jobject thiz,
|
||||||
|
jstring jlogSessionId) {
|
||||||
|
sp<AudioTrack> track = getAudioTrack(env, thiz);
|
||||||
|
if (track == nullptr) {
|
||||||
|
jniThrowException(env, "java/lang/IllegalStateException",
|
||||||
|
"Unable to retrieve AudioTrack pointer for setLogSessionId()");
|
||||||
|
}
|
||||||
|
ScopedUtfChars logSessionId(env, jlogSessionId);
|
||||||
|
ALOGV("%s: logSessionId %s", __func__, logSessionId.c_str());
|
||||||
|
track->setLogSessionId(logSessionId.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
static void android_media_AudioTrack_setPlayerIId(JNIEnv *env, jobject thiz, jint playerIId) {
|
static void android_media_AudioTrack_setPlayerIId(JNIEnv *env, jobject thiz, jint playerIId) {
|
||||||
sp<AudioTrack> track = getAudioTrack(env, thiz);
|
sp<AudioTrack> track = getAudioTrack(env, thiz);
|
||||||
if (track == nullptr) {
|
if (track == nullptr) {
|
||||||
@@ -1506,6 +1518,8 @@ static const JNINativeMethod gMethods[] = {
|
|||||||
(void *)android_media_AudioTrack_getAudioDescriptionMixLeveldB},
|
(void *)android_media_AudioTrack_getAudioDescriptionMixLeveldB},
|
||||||
{"native_set_dual_mono_mode", "(I)I", (void *)android_media_AudioTrack_setDualMonoMode},
|
{"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_get_dual_mono_mode", "([I)I", (void *)android_media_AudioTrack_getDualMonoMode},
|
||||||
|
{"native_setLogSessionId", "(Ljava/lang/String;)V",
|
||||||
|
(void *)android_media_AudioTrack_setLogSessionId},
|
||||||
{"native_setPlayerIId", "(I)V", (void *)android_media_AudioTrack_setPlayerIId},
|
{"native_setPlayerIId", "(I)V", (void *)android_media_AudioTrack_setPlayerIId},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -565,6 +565,11 @@ public class AudioTrack extends PlayerBase
|
|||||||
*/
|
*/
|
||||||
private int mOffloadPaddingFrames = 0;
|
private int mOffloadPaddingFrames = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The log session id used for metrics.
|
||||||
|
*/
|
||||||
|
private String mLogSessionId;
|
||||||
|
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
// Used exclusively by native code
|
// Used exclusively by native code
|
||||||
//--------------------
|
//--------------------
|
||||||
@@ -3968,6 +3973,23 @@ public class AudioTrack extends PlayerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a string handle to this AudioTrack for metrics collection.
|
||||||
|
*
|
||||||
|
* @param logSessionId a string which is used to identify this object
|
||||||
|
* to the metrics service.
|
||||||
|
* @throws IllegalStateException if AudioTrack not initialized.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void setLogSessionId(@NonNull String logSessionId) {
|
||||||
|
if (mState == STATE_UNINITIALIZED) {
|
||||||
|
throw new IllegalStateException("track not initialized");
|
||||||
|
}
|
||||||
|
native_setLogSessionId(logSessionId);
|
||||||
|
mLogSessionId = logSessionId;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// Inner classes
|
// Inner classes
|
||||||
//--------------------
|
//--------------------
|
||||||
@@ -4203,6 +4225,7 @@ public class AudioTrack extends PlayerBase
|
|||||||
private native int native_get_audio_description_mix_level_db(float[] level);
|
private native int native_get_audio_description_mix_level_db(float[] level);
|
||||||
private native int native_set_dual_mono_mode(int dualMonoMode);
|
private native int native_set_dual_mono_mode(int dualMonoMode);
|
||||||
private native int native_get_dual_mono_mode(int[] dualMonoMode);
|
private native int native_get_dual_mono_mode(int[] dualMonoMode);
|
||||||
|
private native void native_setLogSessionId(@NonNull String logSessionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the audio service Player Interface Id.
|
* Sets the audio service Player Interface Id.
|
||||||
|
|||||||
Reference in New Issue
Block a user