Merge "C2SoftVpxEnc: Correct minimum level setting code" am: d08e4950f1
Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2239986
Change-Id: I999979579f6d42eb3bd66126d1f31d080901033b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/media/codec2/components/vpx/C2SoftVpxEnc.cpp b/media/codec2/components/vpx/C2SoftVpxEnc.cpp
index 2a019d4..5700e5d 100644
--- a/media/codec2/components/vpx/C2SoftVpxEnc.cpp
+++ b/media/codec2/components/vpx/C2SoftVpxEnc.cpp
@@ -264,23 +264,20 @@
// 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;
-
- // 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.
- if (needsUpdate) {
- ALOGD("Given level %x does not cover current configuration: "
- "adjusting to %x",
- me.v.level, limit.level);
- me.set().level = limit.level;
+ 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.
+ if (needsUpdate) {
+ ALOGD("Given level %x does not cover current configuration: "
+ "adjusting to %x",
+ me.v.level, limit.level);
+ me.set().level = limit.level;
+ }
+ found = true;
+ break;
}
- 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