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

Commit 37ff0e66 authored by Wei Jia's avatar Wei Jia
Browse files

NuPlayerDecoder: check mCodec before dereferencing it.

Test: media cts tests
Bug: 37538141
Change-Id: Ib95fd4786242d6742f3bdc7aab28f79d43e8da81
parent b6ed37ed
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;