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

Commit 3554f4eb authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "NuPlayer: improve get video info from outputFormat" into main

parents da1dca0f f939ae92
Loading
Loading
Loading
Loading
+23 −9
Original line number Diff line number Diff line
@@ -2077,17 +2077,27 @@ void NuPlayer::updateVideoSize(
        return;
    }

    int32_t displayWidth, displayHeight;
    int32_t displayWidth = 0, displayHeight = 0;
    if (outputFormat != NULL) {
        int32_t width, height, cropLeft, cropTop, cropRight, cropBottom;
        if (outputFormat->findInt32("width", &width)
                && outputFormat->findInt32("height", &height)
                && outputFormat->findRect(
        int32_t width, height;
        if (!outputFormat->findInt32("width", &width)
                || !outputFormat->findInt32("height", &height)) {
            ALOGW("Video output format missing dimension: %s",
                    outputFormat->debugString().c_str());
            notifyListener(MEDIA_SET_VIDEO_SIZE, 0, 0);
            return;
        }

        int32_t cropLeft, cropTop, cropRight, cropBottom;
        if (outputFormat->findRect(
                "crop",
                &cropLeft, &cropTop, &cropRight, &cropBottom)) {

            displayWidth = cropRight - cropLeft + 1;
            displayHeight = cropBottom - cropTop + 1;
        } else {
            displayWidth = width;
            displayHeight = height;
        }

        ALOGV("Video output format changed to %d x %d "
                "(crop: %d x %d @ (%d, %d))",
@@ -2095,7 +2105,6 @@ void NuPlayer::updateVideoSize(
                displayWidth,
                displayHeight,
                cropLeft, cropTop);
        }
    } else {
        if (!inputFormat->findInt32("width", &displayWidth)
            || !inputFormat->findInt32("height", &displayHeight)) {
@@ -2143,6 +2152,11 @@ void NuPlayer::updateVideoSize(
        displayHeight = tmp;
    }

    if (displayWidth <= 0 || displayHeight <= 0) {
        ALOGE("video size is corrupted or bad, reset it to 0");
        displayWidth = displayHeight = 0;
    }

    notifyListener(
            MEDIA_SET_VIDEO_SIZE,
            displayWidth,