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

Commit 5f689724 authored by Fyodor Kyslov's avatar Fyodor Kyslov
Browse files

APV: Set the limit of max resolution for the decoder

Test: CodecDecoderTest
Bug: 396060145
Change-Id: I91eb3a62c195609ffc05171c6ccd62bea4722d92
parent 7777cd64
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ const char* MEDIA_MIMETYPE_VIDEO_APV = "video/apv";

#define MAX_NUM_FRMS (1)  // supports only 1-frame output
#define FRM_IDX (0)       // supports only 1-frame output
#define MAX_SUPPORTED_WIDTH (4096)
#define MAX_SUPPORTED_HEIGHT (4096)
// check generic frame or not
#define IS_NON_AUX_FRM(frm)                              \
    (((frm)->pbu_type == OAPV_PBU_TYPE_PRIMARY_FRAME) || \
@@ -76,8 +78,8 @@ class C2SoftApvDec::IntfImpl : public SimpleInterface<void>::BaseParams {
        addParameter(DefineParam(mSize, C2_PARAMKEY_PICTURE_SIZE)
                             .withDefault(new C2StreamPictureSizeInfo::output(0u, 320, 240))
                             .withFields({
                                     C2F(mSize, width).inRange(2, 4096),
                                     C2F(mSize, height).inRange(2, 4096),
                                     C2F(mSize, width).inRange(2, MAX_SUPPORTED_WIDTH),
                                     C2F(mSize, height).inRange(2, MAX_SUPPORTED_HEIGHT),
                             })
                             .withSetter(SizeSetter)
                             .build());
@@ -945,6 +947,7 @@ void C2SoftApvDec::process(const std::unique_ptr<C2Work>& work,

        if (OAPV_FAILED(oapvd_info(bitb.addr, bitb.ssize, &aui))) {
            ALOGE("cannot get information from bitstream");
            work->result = C2_CORRUPTED;
            return;
        }

@@ -965,6 +968,12 @@ void C2SoftApvDec::process(const std::unique_ptr<C2Work>& work,
                mHeight = finfo->h;
            }

            if (mWidth > MAX_SUPPORTED_WIDTH || mHeight > MAX_SUPPORTED_HEIGHT) {
                ALOGE("Stream resolution of %dx%d is not supported.", mWidth, mHeight);
                work->result = C2_CORRUPTED;
                return;
            }

            if (frm->imgb != NULL && (frm->imgb->w[0] != finfo->w || frm->imgb->h[0] != finfo->h)) {
                frm->imgb->release(frm->imgb);
                frm->imgb = NULL;