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

Commit 947c4c61 authored by Santiago Seifert's avatar Santiago Seifert Committed by Automerger Merge Worker
Browse files

Merge "Rename MediaExtractor symbols to log session id" into sc-dev am: 9642d628

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14340811

Change-Id: I646043dd0e1a332439dc0c4b0845aa82f0943b02
parents 58f1beb4 9642d628
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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();
+24 −0
Original line number Diff line number Diff line
@@ -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 },
};
+2 −0
Original line number Diff line number Diff line
@@ -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();