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

Commit 1d5146df authored by Yichi Chen's avatar Yichi Chen
Browse files

SF: Handle the empty hdr10plus metadata in setPerFrameMetadata

There was a case that Media enabled HDR10PLUS in validTypes without
passing any metadata.The patch handles the error to avoid the crash of
SurfaceFlinger.

Bug: 157868992
Test: atest android.mediav2.cts.CodecDecoderSurfaceTest
Change-Id: I57275672ef2fe8079e652094e77a0a50de10c5b9
parent 680edcf1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1676,6 +1676,7 @@ void CommandReader::takeClientTargetProperty(
    if (found == mReturnData.end()) {
        outClientTargetProperty->pixelFormat = PixelFormat::RGBA_8888;
        outClientTargetProperty->dataspace = Dataspace::UNKNOWN;
        return;
    }

    ReturnData& data = found->second;
+4 −0
Original line number Diff line number Diff line
@@ -894,6 +894,10 @@ Error Layer::setPerFrameMetadata(const int32_t supportedPerFrameMetadata,
            mComposer.setLayerPerFrameMetadata(mDisplayId, mId, perFrameMetadatas));

    if (validTypes & HdrMetadata::HDR10PLUS) {
        if (CC_UNLIKELY(mHdrMetadata.hdr10plus.size() == 0)) {
            return Error::BAD_PARAMETER;
        }

        std::vector<Hwc2::PerFrameMetadataBlob> perFrameMetadataBlobs;
        perFrameMetadataBlobs.push_back(
                {Hwc2::PerFrameMetadataKey::HDR10_PLUS_SEI, mHdrMetadata.hdr10plus});