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

Commit f0990aa3 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7795143 from 70ddc96c to sc-v2-release

Change-Id: Ie6d1edfa8c2e924a0658042547e88ca0776536b6
parents 324db1b0 70ddc96c
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -610,18 +610,19 @@ OSCL_EXPORT_REF Bool PVInitVideoEncoder(VideoEncControls *encoderControl, Vid
    /* Find the maximum width*height for memory allocation of the VOPs */
    for (idx = 0; idx < nLayers; idx++)
    {
        temp_w = video->encParams->LayerWidth[idx];
        temp_h = video->encParams->LayerHeight[idx];
        temp_w = ((video->encParams->LayerWidth[idx] + 15) >> 4) << 4;
        temp_h = ((video->encParams->LayerHeight[idx] + 15) >> 4) << 4;

        if (temp_w > 2048 || temp_h > 2048) {
            goto CLEAN_UP;
        }

        if ((temp_w*temp_h) > max)
        {
            max = temp_w * temp_h;
            max_width = ((temp_w + 15) >> 4) << 4;
            max_height = ((temp_h + 15) >> 4) << 4;
            if (((uint64_t)max_width * max_height) > (uint64_t)INT32_MAX
                    || temp_w > INT32_MAX - 15 || temp_h > INT32_MAX - 15) {
                goto CLEAN_UP;
            }
            max_width = temp_w;
            max_height = temp_h;

            nTotalMB = ((max_width * max_height) >> 8);
        }