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

Commit a36680d4 authored by Arun Johnson's avatar Arun Johnson
Browse files

MultiAccessUnits: Encoder max output values

 Max output values for the encoders are set to max input values
 if the configured max output values are less than the codec
 reported max input values. This is to make sure that the
 access units from the encoders can be contained in the large
 buffer

Bug: 324899408
Test: atest android.mediav2.cts.CodecEncoderMultiAccessUnitTest
Change-Id: Ieb3a38ad433a326d0495afc0d2aa4dd4f9ad24c5
parent 261b7126
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -79,6 +79,26 @@ struct CompIntf : public ConfigurableC2Intf {
        }
        c2_status_t err2 = C2_OK;
        if (paramsToLargeFrameIntf.size() > 0) {
            C2ComponentKindSetting kind;
            C2StreamMaxBufferSizeInfo::input maxInputSize(0);
            c2_status_t err = mIntf->query_vb(
                    {&kind, &maxInputSize}, {}, C2_MAY_BLOCK, nullptr);
            if ((err == C2_OK) && (kind.value == C2Component::KIND_ENCODER)) {
                for (int i = 0 ; i < paramsToLargeFrameIntf.size(); i++) {
                    if (paramsToLargeFrameIntf[i]->index() ==
                            C2LargeFrame::output::PARAM_TYPE) {
                        C2LargeFrame::output *lfp = C2LargeFrame::output::From(
                                    paramsToLargeFrameIntf[i]);
                        // This is assuming a worst case compression ratio of 1:1
                        // In no case the encoder should give an output more than
                        // what is being provided to the encoder in a single call.
                        if (lfp && (lfp->maxSize < maxInputSize.value)) {
                            lfp->maxSize = maxInputSize.value;
                        }
                        break;
                    }
                }
            }
            err2 = mMultiAccessUnitIntf->config(
                    paramsToLargeFrameIntf, mayBlock, failures);
        }
+20 −0
Original line number Diff line number Diff line
@@ -78,6 +78,26 @@ struct CompIntf : public ConfigurableC2Intf {
        }
        c2_status_t err2 = C2_OK;
        if (paramsToLargeFrameIntf.size() > 0) {
            C2ComponentKindSetting kind;
            C2StreamMaxBufferSizeInfo::input maxInputSize(0);
            c2_status_t err = mIntf->query_vb(
                    {&kind, &maxInputSize}, {}, C2_MAY_BLOCK, nullptr);
            if ((err == C2_OK) && (kind.value == C2Component::KIND_ENCODER)) {
                for (int i = 0 ; i < paramsToLargeFrameIntf.size(); i++) {
                    if (paramsToLargeFrameIntf[i]->index() ==
                            C2LargeFrame::output::PARAM_TYPE) {
                        C2LargeFrame::output *lfp = C2LargeFrame::output::From(
                                    paramsToLargeFrameIntf[i]);
                        // This is assuming a worst case compression ratio of 1:1
                        // In no case the encoder should give an output more than
                        // what is being provided to the encoder in a single call.
                        if (lfp && (lfp->maxSize < maxInputSize.value)) {
                            lfp->maxSize = maxInputSize.value;
                        }
                        break;
                    }
                }
            }
            err2 = mMultiAccessUnitIntf->config(
                    paramsToLargeFrameIntf, mayBlock, failures);
        }