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

Commit d7f77cd7 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "MediaCodec: Fix deallocated pointer reference when calling reset()" into lmp-dev

parents 0079b331 dc9f58dc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ private:

    static void PostReplyWithError(int32_t replyID, int32_t err);

    status_t init(const char *name, bool nameIsType, bool encoder);
    status_t init(const AString &name, bool nameIsType, bool encoder);

    void setState(State newState);
    void returnBuffersToCodec();
+3 −3
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ void MediaCodec::PostReplyWithError(int32_t replyID, int32_t err) {
    response->postReply(replyID);
}

status_t MediaCodec::init(const char *name, bool nameIsType, bool encoder) {
status_t MediaCodec::init(const AString &name, bool nameIsType, bool encoder) {
    // save init parameters for reset
    mInitName = name;
    mInitNameIsType = nameIsType;
@@ -191,7 +191,7 @@ status_t MediaCodec::init(const char *name, bool nameIsType, bool encoder) {
    // queue.
    mCodec = new ACodec;
    bool needDedicatedLooper = false;
    if (nameIsType && !strncasecmp(name, "video/", 6)) {
    if (nameIsType && !strncasecmp(name.c_str(), "video/", 6)) {
        needDedicatedLooper = true;
    } else {
        AString tmp = name;
@@ -357,7 +357,7 @@ status_t MediaCodec::reset() {
    mHaveInputSurface = false;

    if (err == OK) {
        err = init(mInitName.c_str(), mInitNameIsType, mInitIsEncoder);
        err = init(mInitName, mInitNameIsType, mInitIsEncoder);
    }
    return err;
}