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

Commit 71f4c630 authored by Wei Jia's avatar Wei Jia Committed by android-build-merger
Browse files

Merge "NuPlayerDecoder: check mCodec before dereferencing it." into oc-dev am: c84e294c

am: 2fbf2444

Change-Id: I679afd7e4efa037bec61586ec2253a7e2daed26c
parents b04bbe15 2fbf2444
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -95,7 +95,11 @@ NuPlayer::Decoder::Decoder(
}

NuPlayer::Decoder::~Decoder() {
    // Need to stop looper first since mCodec could be accessed on the mDecoderLooper.
    stopLooper();
    if (mCodec != NULL) {
        mCodec->release();
    }
    releaseAndResetMediaBuffers();
}

+6 −2
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@ NuPlayer::DecoderBase::DecoderBase(const sp<AMessage> &notify)
}

NuPlayer::DecoderBase::~DecoderBase() {
    mDecoderLooper->unregisterHandler(id());
    mDecoderLooper->stop();
    stopLooper();
}

static
@@ -73,6 +72,11 @@ void NuPlayer::DecoderBase::init() {
    mDecoderLooper->registerHandler(this);
}

void NuPlayer::DecoderBase::stopLooper() {
    mDecoderLooper->unregisterHandler(id());
    mDecoderLooper->stop();
}

void NuPlayer::DecoderBase::setParameters(const sp<AMessage> &params) {
    sp<AMessage> msg = new AMessage(kWhatSetParameters, this);
    msg->setMessage("params", params);
+2 −0
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@ protected:

    virtual ~DecoderBase();

    void stopLooper();

    virtual void onMessageReceived(const sp<AMessage> &msg);

    virtual void onConfigure(const sp<AMessage> &format) = 0;