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

Commit cc3bbba8 authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "Handle nullptr if memory allocation fails" into sc-dev

parents af74d232 1f44bfba
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -644,6 +644,10 @@ status_t VideoFrameDecoder::onOutputReceived(
                0,
                dstBpp(),
                mCaptureLayer != nullptr /*allocRotated*/);
        if (frameMem == nullptr) {
            return NO_MEMORY;
        }

        mFrame = static_cast<VideoFrame*>(frameMem->unsecurePointer());

        setFrame(frameMem);
@@ -886,6 +890,11 @@ status_t ImageDecoder::onOutputReceived(
    if (mFrame == NULL) {
        sp<IMemory> frameMem = allocVideoFrame(
                trackMeta(), mWidth, mHeight, mTileWidth, mTileHeight, dstBpp());

        if (frameMem == nullptr) {
            return NO_MEMORY;
        }

        mFrame = static_cast<VideoFrame*>(frameMem->unsecurePointer());

        setFrame(frameMem);