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

Commit 5997bb0d authored by Arun Johnson's avatar Arun Johnson
Browse files

Fixes for out-of-memory error in MediaCodec

 Handle MediaCodec looper start error
 Handle error in requestInitialInputBuffers
 in CCodecBufferChannel

Bug: 189846872

Change-Id: I46490776484dd182bc71e26baaec02b574d7a2f9
parent 298764fd
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1803,9 +1803,16 @@ void CCodec::start() {
    if (tryAndReportOnError(setRunning) != OK) {
        return;
    }

    err2 = mChannel->requestInitialInputBuffers();

    if (err2 != OK) {
        ALOGE("Initial request for Input Buffers failed");
        mCallback->onError(err2,ACTION_CODE_FATAL);
        return;
    }
    mCallback->onStartCompleted();

    (void)mChannel->requestInitialInputBuffers();
}

void CCodec::initiateShutdown(bool keepComponentAllocated) {
+6 −1
Original line number Diff line number Diff line
@@ -1418,9 +1418,14 @@ status_t MediaCodec::init(const AString &name) {
    if (mIsVideo) {
        // video codec needs dedicated looper
        if (mCodecLooper == NULL) {
            status_t err = OK;
            mCodecLooper = new ALooper;
            mCodecLooper->setName("CodecLooper");
            mCodecLooper->start(false, false, ANDROID_PRIORITY_AUDIO);
            err = mCodecLooper->start(false, false, ANDROID_PRIORITY_AUDIO);
            if (OK != err) {
                ALOGE("Codec Looper failed to start");
                return err;
            }
        }

        mCodecLooper->registerHandler(mCodec);