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

Commit 597ba531 authored by Arun Johnson's avatar Arun Johnson Committed by Automerger Merge Worker
Browse files

Merge "Check bit-depth before creating converters" into tm-dev am: f9591d6b

parents 7c0a8745 f9591d6b
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1016,6 +1016,10 @@ void CCodecBufferChannel::getInputBufferArray(Vector<sp<MediaCodecBuffer>> *arra
    array->clear();
    Mutexed<Input>::Locked input(mInput);

    if (!input->buffers) {
        ALOGE("getInputBufferArray: No Input Buffers allocated");
        return;
    }
    if (!input->buffers->isArrayMode()) {
        input->buffers = input->buffers->toArrayMode(input->numSlots);
    }
@@ -1026,7 +1030,10 @@ void CCodecBufferChannel::getInputBufferArray(Vector<sp<MediaCodecBuffer>> *arra
void CCodecBufferChannel::getOutputBufferArray(Vector<sp<MediaCodecBuffer>> *array) {
    array->clear();
    Mutexed<Output>::Locked output(mOutput);

    if (!output->buffers) {
        ALOGE("getOutputBufferArray: No Output Buffers allocated");
        return;
    }
    if (!output->buffers->isArrayMode()) {
        output->buffers = output->buffers->toArrayMode(output->numSlots);
    }
+33 −0
Original line number Diff line number Diff line
@@ -268,6 +268,39 @@ public:
                    mInitCheck = BAD_VALUE;
                    return;
                }
                std::optional<int> clientBitDepth = {};
                switch (mClientColorFormat) {
                    case COLOR_FormatYUVP010:
                        clientBitDepth = 10;
                        break;
                    case COLOR_FormatYUV411PackedPlanar:
                    case COLOR_FormatYUV411Planar:
                    case COLOR_FormatYUV420Flexible:
                    case COLOR_FormatYUV420PackedPlanar:
                    case COLOR_FormatYUV420PackedSemiPlanar:
                    case COLOR_FormatYUV420Planar:
                    case COLOR_FormatYUV420SemiPlanar:
                    case COLOR_FormatYUV422Flexible:
                    case COLOR_FormatYUV422PackedPlanar:
                    case COLOR_FormatYUV422PackedSemiPlanar:
                    case COLOR_FormatYUV422Planar:
                    case COLOR_FormatYUV422SemiPlanar:
                    case COLOR_FormatYUV444Flexible:
                    case COLOR_FormatYUV444Interleaved:
                        clientBitDepth = 8;
                        break;
                    default:
                        // no-op; used with optional
                        break;

                }
                // conversion fails if client bit-depth and the component bit-depth differs
                if ((clientBitDepth) && (bitDepth != clientBitDepth.value())) {
                    ALOGD("Bit depth of client: %d and component: %d differs",
                        *clientBitDepth, bitDepth);
                    mInitCheck = BAD_VALUE;
                    return;
                }
                C2PlaneInfo yPlane = layout.planes[C2PlanarLayout::PLANE_Y];
                C2PlaneInfo uPlane = layout.planes[C2PlanarLayout::PLANE_U];
                C2PlaneInfo vPlane = layout.planes[C2PlanarLayout::PLANE_V];
+8 −2
Original line number Diff line number Diff line
@@ -121,7 +121,10 @@ static status_t _ImageCopy(View &view, const MediaImage2 *img, ImagePixel *imgBa
}  // namespace

status_t ImageCopy(uint8_t *imgBase, const MediaImage2 *img, const C2GraphicView &view) {
    if (view.crop().width != img->mWidth || view.crop().height != img->mHeight) {
    if (img == nullptr
        || imgBase == nullptr
        || view.crop().width != img->mWidth
        || view.crop().height != img->mHeight) {
        return BAD_VALUE;
    }
    const uint8_t* src_y = view.data()[0];
@@ -203,7 +206,10 @@ status_t ImageCopy(uint8_t *imgBase, const MediaImage2 *img, const C2GraphicView
}

status_t ImageCopy(C2GraphicView &view, const uint8_t *imgBase, const MediaImage2 *img) {
    if (view.crop().width != img->mWidth || view.crop().height != img->mHeight) {
    if (img == nullptr
        || imgBase == nullptr
        || view.crop().width != img->mWidth
        || view.crop().height != img->mHeight) {
        return BAD_VALUE;
    }
    const uint8_t* src_y = imgBase + img->mPlane[0].mOffset;