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

Commit 89f8fc52 authored by Andrew Lewis's avatar Andrew Lewis
Browse files

Fix setting int operating rate via setParameters

configureCodec supports setting 'operating-rate' with either an int or
a float value. Update setParameters to allow both types as well.

Also ignore errors setting the parameter, like for configuration.

Fixes: 71987865
Test: build succeeded
Change-Id: Icb095b718840f73d02e18c6325e3f636aac784f5
parent 7c9dbd54
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -7289,12 +7289,16 @@ status_t ACodec::setParameters(const sp<AMessage> &params) {
        }
    }

    float rate;
    if (params->findFloat("operating-rate", &rate) && rate > 0) {
        status_t err = setOperatingRate(rate, mIsVideo);
    int32_t rateInt = -1;
    float rateFloat = -1;
    if (!params->findFloat("operating-rate", &rateFloat)) {
        params->findInt32("operating-rate", &rateInt);
        rateFloat = (float) rateInt; // 16MHz (FLINTMAX) is OK for upper bound.
    }
    if (rateFloat > 0) {
        status_t err = setOperatingRate(rateFloat, mIsVideo);
        if (err != OK) {
            ALOGE("Failed to set parameter 'operating-rate' (err %d)", err);
            return err;
            ALOGI("Failed to set parameter 'operating-rate' (err %d)", err);
        }
    }

@@ -7319,10 +7323,8 @@ status_t ACodec::setParameters(const sp<AMessage> &params) {
        }
    }

    status_t err = configureTemporalLayers(params, false /* inConfigure */, mOutputFormat);
    if (err != OK) {
        err = OK; // ignore failure
    }
    // Ignore errors as failure is expected for codecs that aren't video encoders.
    (void)configureTemporalLayers(params, false /* inConfigure */, mOutputFormat);

    return setVendorParameters(params);
}