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

Commit 09bfb518 authored by Yixiao Luo's avatar Yixiao Luo Committed by Android (Google) Code Review
Browse files

Merge "Add null pointer checks for FetchLinearBlock" into main

parents 9a2e74cb 72c24a47
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -679,6 +679,11 @@ status_t FrameDecoder::extractInternalUsingBlockModel() {
    size_t inputSize = mediaBuffer->range_length();
    size_t inputSize = mediaBuffer->range_length();
    std::shared_ptr<C2LinearBlock> block =
    std::shared_ptr<C2LinearBlock> block =
            MediaCodec::FetchLinearBlock(inputSize, {std::string{mComponentName.c_str()}});
            MediaCodec::FetchLinearBlock(inputSize, {std::string{mComponentName.c_str()}});
    if (block == NULL) {
        ALOGE("Fatal error: FetchLinearBlock returned NULL");
        mediaBuffer->release();
        return NO_MEMORY;
    }
    C2WriteView view{block->map().get()};
    C2WriteView view{block->map().get()};
    if (view.error() != C2_OK) {
    if (view.error() != C2_OK) {
        ALOGE("Fatal error: failed to allocate and map a block");
        ALOGE("Fatal error: failed to allocate and map a block");
+4 −0
Original line number Original line Diff line number Diff line
@@ -6643,6 +6643,10 @@ status_t MediaCodec::queueCSDInputBuffer(size_t bufferIndex) {
        } else {
        } else {
            std::shared_ptr<C2LinearBlock> block =
            std::shared_ptr<C2LinearBlock> block =
                FetchLinearBlock(csd->size(), {std::string{mComponentName.c_str()}});
                FetchLinearBlock(csd->size(), {std::string{mComponentName.c_str()}});
            if (block == NULL) {
                mErrorLog.log(LOG_TAG, "Fatal error: FetchLinearBlock returned NULL");
                return -EINVAL;
            }
            C2WriteView view{block->map().get()};
            C2WriteView view{block->map().get()};
            if (view.error() != C2_OK) {
            if (view.error() != C2_OK) {
                mErrorLog.log(LOG_TAG, "Fatal error: failed to allocate and map a block");
                mErrorLog.log(LOG_TAG, "Fatal error: failed to allocate and map a block");