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

Commit a786d710 authored by Harish Mahendrakar's avatar Harish Mahendrakar
Browse files

C2SoftVpxEnc: Correct minimum level setting code

When the encoder is given a level lower than required for the
current configuration, plugin wasn't setting it correctly.

Bug: 151430764
Test: Uncomment the parameter for VP9 in the CTS test
 atest android.mediav2.cts.EncoderProfileLevelTest

Change-Id: I123c8d00b6b09858b732d1f741cf92e241067a79
parent 985ef526
Loading
Loading
Loading
Loading
+13 −16
Original line number Diff line number Diff line
@@ -264,11 +264,8 @@ C2R C2SoftVpxEnc::IntfImpl::ProfileLevelSetter(bool mayBlock,
    // the requirements.
    bool needsUpdate = false;
    for (const LevelLimits& limit : kLimits) {
        if (samples > limit.samples) continue;
        if (samplesPerSec > limit.samplesPerSec) continue;
        if (bitrate.v.value > limit.bitrate) continue;
        if (dimension > limit.dimension) continue;

        if (samples <= limit.samples && samplesPerSec <= limit.samplesPerSec &&
            bitrate.v.value <= limit.bitrate && dimension <= limit.dimension) {
            // This is the lowest level that meets the requirements, and if
            // we haven't seen the supplied level yet, that means we don't
            // need the update.
@@ -280,7 +277,7 @@ C2R C2SoftVpxEnc::IntfImpl::ProfileLevelSetter(bool mayBlock,
            }
            found = true;
            break;

        }
        if (me.v.level == limit.level) {
            // We break out of the loop when the lowest feasible level is
            // found. The fact that we're here means that our level doesn't