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

Commit 0812979c authored by Wonsik Kim's avatar Wonsik Kim Committed by android-build-merger
Browse files

Merge "media: keep JMediaCodec::mCodec reference until destruction" into qt-dev am: 8a1174bc

am: 3533116e

Change-Id: I1e098fe688632adb1a713ffa057d05a3920363b7
parents bd90af7d 3533116e
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -211,9 +211,9 @@ void JMediaCodec::registerSelf() {
}

void JMediaCodec::release() {
    std::call_once(mReleaseFlag, [this] {
        if (mCodec != NULL) {
            mCodec->release();
        mCodec.clear();
            mInitStatus = NO_INIT;
        }

@@ -222,10 +222,11 @@ void JMediaCodec::release() {
            mLooper->stop();
            mLooper.clear();
        }
    });
}

JMediaCodec::~JMediaCodec() {
    if (mCodec != NULL || mLooper != NULL) {
    if (mLooper != NULL) {
        /* MediaCodec and looper should have been released explicitly already
         * in setMediaCodec() (see comments in setMediaCodec()).
         *
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#ifndef _ANDROID_MEDIA_MEDIACODEC_H_
#define _ANDROID_MEDIA_MEDIACODEC_H_

#include <mutex>

#include "jni.h"

#include <media/MediaAnalyticsItem.h>
@@ -156,6 +158,7 @@ private:
    sp<ALooper> mLooper;
    sp<MediaCodec> mCodec;
    AString mNameAtCreation;
    std::once_flag mReleaseFlag;

    sp<AMessage> mCallbackNotification;
    sp<AMessage> mOnFrameRenderedNotification;