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

Commit c123ba0b authored by Songyue Han's avatar Songyue Han
Browse files

CodecCapabilities: Allow returning NULL for getAchievableFrameRatesFor() if no...

CodecCapabilities: Allow returning NULL for getAchievableFrameRatesFor() if no measurement data is published.

Bug: 422728243
Test: atest NativeAMediaCodecInfoTest
Flag: EXEMPT bugfix
Change-Id: I4a131360e921696215cb5d038fd72a17bb76fd4d
parent 0bb87e65
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -686,9 +686,14 @@ static jobject android_media_VideoCapabilities_getAchievableFrameRatesFor(JNIEnv
        return NULL;
    }

    if (!videoCaps->supports(width, height, std::nullopt)) {
        jniThrowException(env, "java/lang/IllegalArgumentException", "unsupported size");
        return NULL;
    }

    std::optional<Range<double>> frameRates = videoCaps->getAchievableFrameRatesFor(width, height);
    if (!frameRates) {
        jniThrowException(env, "java/lang/IllegalArgumentException", "unsupported size");
        // Return NULL if the device doesn't publish data for that resolution
        return NULL;
    }
    jobject jFrameRates = convertToJavaDoubleRange(env, frameRates.value());