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

Commit 9642d628 authored by Santiago Seifert's avatar Santiago Seifert Committed by Android (Google) Code Review
Browse files

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

parents a8559261 14cdc32b
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();