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

Commit d97b1b39 authored by Wonsik Kim's avatar Wonsik Kim Committed by Android (Google) Code Review
Browse files

Merge "CCodec: support legacy bitrate change behavior"

parents b5d428af aa484acd
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -772,8 +772,16 @@ void CCodec::configure(const sp<AMessage> &msg) {
        }

        std::vector<std::unique_ptr<C2Param>> configUpdate;
        // NOTE: We used to ignore "video-bitrate" at configure; replicate
        //       the behavior here.
        sp<AMessage> sdkParams = msg;
        int32_t videoBitrate;
        if (sdkParams->findInt32(PARAMETER_KEY_VIDEO_BITRATE, &videoBitrate)) {
            sdkParams = msg->dup();
            sdkParams->removeEntryAt(sdkParams->findEntryByName(PARAMETER_KEY_VIDEO_BITRATE));
        }
        status_t err = config->getConfigUpdateFromSdkParams(
                comp, msg, Config::IS_CONFIG, C2_DONT_BLOCK, &configUpdate);
                comp, sdkParams, Config::IS_CONFIG, C2_DONT_BLOCK, &configUpdate);
        if (err != OK) {
            ALOGW("failed to convert configuration to c2 params");
        }
@@ -1415,11 +1423,7 @@ void CCodec::signalResume() {
    (void)mChannel->requestInitialInputBuffers();
}

void CCodec::signalSetParameters(const sp<AMessage> &params) {
    setParameters(params);
}

void CCodec::setParameters(const sp<AMessage> &params) {
void CCodec::signalSetParameters(const sp<AMessage> &msg) {
    std::shared_ptr<Codec2Client::Component> comp;
    auto checkState = [this, &comp] {
        Mutexed<State>::Locked state(mState);
@@ -1433,6 +1437,15 @@ void CCodec::setParameters(const sp<AMessage> &params) {
        return;
    }

    // NOTE: We used to ignore "bitrate" at setParameters; replicate
    //       the behavior here.
    sp<AMessage> params = msg;
    int32_t bitrate;
    if (params->findInt32(KEY_BIT_RATE, &bitrate)) {
        params = msg->dup();
        params->removeEntryAt(params->findEntryByName(KEY_BIT_RATE));
    }

    Mutexed<Config>::Locked config(mConfig);

    /**
+0 −1
Original line number Diff line number Diff line
@@ -102,7 +102,6 @@ private:
    void createInputSurface();
    void setInputSurface(const sp<PersistentSurface> &surface);
    status_t setupInputSurface(const std::shared_ptr<InputSurfaceWrapper> &surface);
    void setParameters(const sp<AMessage> &params);

    void setDeadline(
            const TimePoint &now,