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

Commit a7a959a9 authored by Songyue Han's avatar Songyue Han Committed by Android (Google) Code Review
Browse files

Merge "Log pixel format metric for encoders using surface." into main

parents f8de0351 2a8d8834
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -202,8 +202,10 @@ C2OMXNode::C2OMXNode(const std::shared_ptr<Codec2Client::Component> &comp)
    android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_WARN_ALWAYS);
    mQueueThread->run("C2OMXNode", PRIORITY_AUDIO);

    Mutexed<android_dataspace>::Locked ds(mDataspace);
    *ds = HAL_DATASPACE_UNKNOWN;
    android_dataspace ds = HAL_DATASPACE_UNKNOWN;
    mDataspace.lock().set(ds);
    uint32_t pf = PIXEL_FORMAT_UNKNOWN;
    mPixelFormat.lock().set(pf);
}

status_t C2OMXNode::freeNode() {
@@ -521,8 +523,8 @@ status_t C2OMXNode::dispatchMessage(const omx_message& msg) {
    ALOGD("dataspace changed to %#x pixel format: %#x", dataSpace, pixelFormat);
    mQueueThread->setDataspace(dataSpace);

    Mutexed<android_dataspace>::Locked ds(mDataspace);
    *ds = dataSpace;
    mDataspace.lock().set(dataSpace);
    mPixelFormat.lock().set(pixelFormat);
    return OK;
}

@@ -559,6 +561,10 @@ android_dataspace C2OMXNode::getDataspace() {
    return *mDataspace.lock();
}

uint32_t C2OMXNode::getPixelFormat() {
    return *mPixelFormat.lock();
}

void C2OMXNode::setPriority(int priority) {
    mQueueThread->setPriority(priority);
}
+6 −0
Original line number Diff line number Diff line
@@ -98,6 +98,11 @@ struct C2OMXNode : public BnOMXNode {
     */
    android_dataspace getDataspace();

    /**
     * Returns dataspace information from GraphicBufferSource.
     */
    uint32_t getPixelFormat();

    /**
     * Sets priority of the queue thread.
     */
@@ -112,6 +117,7 @@ private:
    uint32_t mHeight;
    uint64_t mUsage;
    Mutexed<android_dataspace> mDataspace;
    Mutexed<uint32_t> mPixelFormat;

    // WORKAROUND: timestamp adjustment

+6 −0
Original line number Diff line number Diff line
@@ -431,6 +431,10 @@ public:
        return mNode->getDataspace();
    }

    uint32_t getPixelFormat() override {
        return mNode->getPixelFormat();
    }

private:
    sp<HGraphicBufferSource> mSource;
    sp<C2OMXNode> mNode;
@@ -2510,6 +2514,8 @@ void CCodec::onMessageReceived(const sp<AMessage> &msg) {
                uint32_t pf = PIXEL_FORMAT_UNKNOWN;
                if (!config->mInputSurface) {
                    pf = mChannel->getBuffersPixelFormat(config->mDomain & Config::IS_ENCODER);
                } else {
                    pf = config->mInputSurface->getPixelFormat();
                }
                if (pf != PIXEL_FORMAT_UNKNOWN) {
                    mMetrics->setInt64(kCodecPixelFormat, pf);
+6 −0
Original line number Diff line number Diff line
@@ -112,8 +112,14 @@ public:
     */
    virtual android_dataspace getDataspace() { return mDataSpace; }

    /**
     * Returns pixel format information from GraphicBufferSource.
     */
    virtual uint32_t getPixelFormat() { return mPixelFormat; }

protected:
    android_dataspace mDataSpace;
    uint32_t mPixelFormat;
};

}  // namespace android