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

Commit fe121d44 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "free weakref to linearblock when it is destroy" am: a4f4128f

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibe28578ed7dc7fd22abfe7520c450e350d5c8090
parents 7155480d a4f4128f
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -171,6 +171,12 @@ static int IP_V6_LENGTH = 16;

void DestroyCallback(const C2Buffer * /* buf */, void *arg) {
    android::sp<android::MediaEvent> event = (android::MediaEvent *)arg;
    if (event->mLinearBlockObj != NULL) {
        JNIEnv *env = android::AndroidRuntime::getJNIEnv();
        env->DeleteWeakGlobalRef(event->mLinearBlockObj);
        event->mLinearBlockObj = NULL;
    }

    event->mAvHandleRefCnt--;
    event->finalize();
}
@@ -182,6 +188,12 @@ LnbCallback::LnbCallback(jobject lnbObj, LnbId id) : mId(id) {
    mLnb = env->NewWeakGlobalRef(lnbObj);
}

LnbCallback::~LnbCallback() {
    JNIEnv *env = AndroidRuntime::getJNIEnv();
    env->DeleteWeakGlobalRef(mLnb);
    mLnb = NULL;
}

Return<void> LnbCallback::onEvent(LnbEventType lnbEventType) {
    ALOGD("LnbCallback::onEvent, type=%d", lnbEventType);
    JNIEnv *env = AndroidRuntime::getJNIEnv();
@@ -305,6 +317,7 @@ MediaEvent::MediaEvent(sp<IFilter> iFilter, hidl_handle avHandle,
    JNIEnv *env = AndroidRuntime::getJNIEnv();
    mMediaEventObj = env->NewWeakGlobalRef(obj);
    mAvHandle = native_handle_clone(avHandle.getNativeHandle());
    mLinearBlockObj = NULL;
}

MediaEvent::~MediaEvent() {
@@ -367,7 +380,7 @@ jobject MediaEvent::getLinearBlock() {
                true);
        mLinearBlockObj = env->NewWeakGlobalRef(linearBlock);
        mAvHandleRefCnt++;
        return mLinearBlockObj;
        return linearBlock;
    } else {
        native_handle_close(const_cast<native_handle_t*>(
                    reinterpret_cast<const native_handle_t*>(mIonHandle)));
+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ namespace android {

struct LnbCallback : public ILnbCallback {
    LnbCallback(jweak tunerObj, LnbId id);
    ~LnbCallback();
    virtual Return<void> onEvent(LnbEventType lnbEventType);
    virtual Return<void> onDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage);
    jweak mLnb;