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

Commit 8d8aec77 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "IOMX: move max pts gap handling to OMX"

parents 124f54a2 3604cb1a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ public:
    virtual status_t emptyGraphicBuffer(
            buffer_id buffer,
            const sp<GraphicBuffer> &graphicBuffer, OMX_U32 flags,
            OMX_TICKS timestamp, OMX_TICKS origTimestamp, int fenceFd) = 0;
            OMX_TICKS timestamp, int fenceFd) = 0;

    virtual status_t getExtensionIndex(
            const char *parameter_name,
+2 −5
Original line number Diff line number Diff line
@@ -475,14 +475,13 @@ public:
    virtual status_t emptyGraphicBuffer(
            buffer_id buffer,
            const sp<GraphicBuffer> &graphicBuffer, OMX_U32 flags,
            OMX_TICKS timestamp, OMX_TICKS origTimestamp, int fenceFd) {
            OMX_TICKS timestamp, int fenceFd) {
        Parcel data, reply;
        data.writeInterfaceToken(IOMXNode::getInterfaceDescriptor());
        data.writeInt32((int32_t)buffer);
        data.write(*graphicBuffer);
        data.writeInt32(flags);
        data.writeInt64(timestamp);
        data.writeInt64(origTimestamp);
        data.writeInt32(fenceFd >= 0);
        if (fenceFd >= 0) {
            data.writeFileDescriptor(fenceFd, true /* takeOwnership */);
@@ -990,12 +989,10 @@ status_t BnOMXNode::onTransact(
            data.read(*graphicBuffer);
            OMX_U32 flags = data.readInt32();
            OMX_TICKS timestamp = data.readInt64();
            OMX_TICKS origTimestamp = data.readInt64();
            bool haveFence = data.readInt32();
            int fenceFd = haveFence ? ::dup(data.readFileDescriptor()) : -1;
            reply->writeInt32(emptyGraphicBuffer(
                    buffer, graphicBuffer, flags,
                    timestamp, origTimestamp, fenceFd));
                    buffer, graphicBuffer, flags, timestamp, fenceFd));

            return NO_ERROR;
        }
+0 −1
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ interface IGraphicBufferSource {
    void configure(IOMXNode omxNode, int dataSpace);
    void setSuspend(boolean suspend);
    void setRepeatPreviousFrameDelayUs(long repeatAfterUs);
    void setMaxTimestampGapUs(long maxGapUs);
    void setMaxFps(float maxFps);
    void setTimeLapseConfig(long timePerFrameUs, long timePerCaptureUs);
    void setStartTimeUs(long startTimeUs);
+12 −3
Original line number Diff line number Diff line
@@ -1723,8 +1723,12 @@ status_t ACodec::configureCodec(
            mRepeatFrameDelayUs = -1ll;
        }

        // only allow 32-bit value, since we pass it as U32 to OMX.
        if (!msg->findInt64("max-pts-gap-to-encoder", &mMaxPtsGapUs)) {
            mMaxPtsGapUs = -1ll;
        } else if (mMaxPtsGapUs > INT32_MAX || mMaxPtsGapUs < 0) {
            ALOGW("Unsupported value for max pts gap %lld", (long long) mMaxPtsGapUs);
            mMaxPtsGapUs = -1ll;
        }

        if (!msg->findFloat("max-fps-to-encoder", &mMaxFps)) {
@@ -6569,9 +6573,14 @@ status_t ACodec::LoadedState::setupInputSurface() {
    }

    if (mCodec->mMaxPtsGapUs > 0ll) {
        err = statusFromBinderStatus(
                mCodec->mGraphicBufferSource->setMaxTimestampGapUs(
                        mCodec->mMaxPtsGapUs));
        OMX_PARAM_U32TYPE maxPtsGapParams;
        InitOMXParams(&maxPtsGapParams);
        maxPtsGapParams.nPortIndex = kPortIndexInput;
        maxPtsGapParams.nU32 = (uint32_t) mCodec->mMaxPtsGapUs;

        err = mCodec->mOMXNode->setParameter(
                (OMX_INDEXTYPE)OMX_IndexParamMaxFrameDurationForBitrateControl,
                &maxPtsGapParams, sizeof(maxPtsGapParams));

        if (err != OK) {
            ALOGE("[%s] Unable to configure max timestamp gap (err %d)",
+9 −2
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ struct OMXNodeInstance : public BnOMXNode {
    status_t emptyGraphicBuffer(
            OMX::buffer_id buffer,
            const sp<GraphicBuffer> &graphicBuffer, OMX_U32 flags,
            OMX_TICKS timestamp, OMX_TICKS origTimestamp, int fenceFd);
            OMX_TICKS timestamp, int fenceFd);

    status_t getExtensionIndex(
            const char *parameterName, OMX_INDEXTYPE *index);
@@ -162,9 +162,13 @@ private:
    };
    SecureBufferType mSecureBufferType[2];

    // Following are OMX parameters managed by us (instead of the component)
    // OMX_IndexParamMaxFrameDurationForBitrateControl
    KeyedVector<int64_t, int64_t> mOriginalTimeUs;
    bool mShouldRestorePts;
    bool mRestorePtsFailed;
    int64_t mMaxTimestampGapUs;
    int64_t mPrevOriginalTimeUs;
    int64_t mPrevModifiedTimeUs;

    // For debug support
    char *mName;
@@ -250,6 +254,9 @@ private:

    bool handleDataSpaceChanged(omx_message &msg);

    status_t setMaxPtsGapUs(const void *params, size_t size);
    int64_t getCodecTimestamp(OMX_TICKS timestamp);

    OMXNodeInstance(const OMXNodeInstance &);
    OMXNodeInstance &operator=(const OMXNodeInstance &);
};
Loading