Merge "Rename MediaExtractor symbols to log session id" into sc-dev

This commit is contained in:
Santiago Seifert
2021-05-01 10:51:09 +00:00
committed by Android (Google) Code Review
3 changed files with 28 additions and 1 deletions

View File

@@ -774,7 +774,7 @@ public final class MediaExtractor {
*/
public void setLogSessionId(@NonNull LogSessionId logSessionId) {
mLogSessionId = Objects.requireNonNull(logSessionId);
// TODO: implement native_setPlaybackId(playbackId);
native_setLogSessionId(logSessionId.getStringId());
}
/**
@@ -802,6 +802,7 @@ public final class MediaExtractor {
return bundle;
}
private native void native_setLogSessionId(String logSessionId);
private native PersistableBundle native_getMetrics();
private static native final void native_init();

View File

@@ -295,6 +295,10 @@ status_t JMediaExtractor::getAudioPresentations(size_t trackIdx,
AudioPresentationCollection *presentations) const {
return mImpl->getAudioPresentations(trackIdx, presentations);
}
status_t JMediaExtractor::setLogSessionId(const String8 &LogSessionId) {
return mImpl->setLogSessionId(LogSessionId);
}
} // namespace android
////////////////////////////////////////////////////////////////////////////////
@@ -920,6 +924,23 @@ android_media_MediaExtractor_native_getMetrics(JNIEnv * env, jobject thiz)
return mybundle;
}
static void
android_media_MediaExtractor_native_setLogSessionId(
JNIEnv * env, jobject thiz, jstring logSessionIdJString)
{
ALOGV("android_media_MediaExtractor_native_setLogSessionId");
sp<JMediaExtractor> extractor = getMediaExtractor(env, thiz);
if (extractor == nullptr) {
jniThrowException(env, "java/lang/IllegalStateException", nullptr);
}
const char* logSessionId = env->GetStringUTFChars(logSessionIdJString, nullptr);
if (extractor->setLogSessionId(String8(logSessionId)) != OK) {
ALOGE("setLogSessionId failed");
}
env->ReleaseStringUTFChars(logSessionIdJString, logSessionId);
}
static const JNINativeMethod gMethods[] = {
{ "release", "()V", (void *)android_media_MediaExtractor_release },
@@ -990,6 +1011,9 @@ static const JNINativeMethod gMethods[] = {
{"native_getMetrics", "()Landroid/os/PersistableBundle;",
(void *)android_media_MediaExtractor_native_getMetrics},
{ "native_setLogSessionId", "(Ljava/lang/String;)V",
(void *)android_media_MediaExtractor_native_setLogSessionId},
{ "native_getAudioPresentations", "(I)Ljava/util/List;",
(void *)android_media_MediaExtractor_getAudioPresentations },
};

View File

@@ -70,6 +70,8 @@ struct JMediaExtractor : public RefBase {
status_t getAudioPresentations(size_t trackIdx,
AudioPresentationCollection *presentations) const;
status_t setLogSessionId(const String8& LogSessionId);
protected:
virtual ~JMediaExtractor();