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

Commit 40172bbb authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10884398 from 615b4344 to udc-qpr1-release

Change-Id: Id3f13c046143784d74e48d43f34d27cf3f71258c
parents fdb79bb3 615b4344
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

+23 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include <media/stagefright/CCodec.h>
#include <media/stagefright/BufferProducerWrapper.h>
#include <media/stagefright/MediaCodecConstants.h>
#include <media/stagefright/MediaCodecMetricsConstants.h>
#include <media/stagefright/PersistentSurface.h>
#include <media/stagefright/RenderedFrameInfo.h>
#include <utils/NativeHandle.h>
@@ -430,6 +431,10 @@ public:
        return mNode->getDataspace();
    }

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

private:
    sp<HGraphicBufferSource> mSource;
    sp<C2OMXNode> mNode;
@@ -1536,6 +1541,9 @@ void CCodec::configure(const sp<AMessage> &msg) {

    config->queryConfiguration(comp);

    mMetrics = new AMessage;
    mChannel->resetBuffersPixelFormat((config->mDomain & Config::IS_ENCODER) ? true : false);

    mCallback->onComponentConfigured(config->mInputFormat, config->mOutputFormat);
}

@@ -2499,6 +2507,21 @@ void CCodec::onMessageReceived(const sp<AMessage> &msg) {
            }
            mChannel->onWorkDone(
                    std::move(work), outputFormat, initData ? initData.get() : nullptr);
            // log metrics to MediaCodec
            if (mMetrics->countEntries() == 0) {
                Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig);
                const std::unique_ptr<Config> &config = *configLocked;
                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);
                    mCallback->onMetricsUpdated(mMetrics);
                }
            }
            break;
        }
        case kWhatWatch: {
+40 −0
Original line number Diff line number Diff line
@@ -2373,6 +2373,46 @@ void CCodecBufferChannel::setDescrambler(const sp<IDescrambler> &descrambler) {
    mDescrambler = descrambler;
}

uint32_t CCodecBufferChannel::getBuffersPixelFormat(bool isEncoder) {
    if (isEncoder) {
        return getInputBuffersPixelFormat();
    } else {
        return getOutputBuffersPixelFormat();
    }
}

uint32_t CCodecBufferChannel::getInputBuffersPixelFormat() {
    Mutexed<Input>::Locked input(mInput);
    if (input->buffers == nullptr) {
        return PIXEL_FORMAT_UNKNOWN;
    }
    return input->buffers->getPixelFormatIfApplicable();
}

uint32_t CCodecBufferChannel::getOutputBuffersPixelFormat() {
    Mutexed<Output>::Locked output(mOutput);
    if (output->buffers == nullptr) {
        return PIXEL_FORMAT_UNKNOWN;
    }
    return output->buffers->getPixelFormatIfApplicable();
}

void CCodecBufferChannel::resetBuffersPixelFormat(bool isEncoder) {
    if (isEncoder) {
        Mutexed<Input>::Locked input(mInput);
        if (input->buffers == nullptr) {
            return;
        }
        input->buffers->resetPixelFormatIfApplicable();
    } else {
        Mutexed<Output>::Locked output(mOutput);
        if (output->buffers == nullptr) {
            return;
        }
        output->buffers->resetPixelFormatIfApplicable();
    }
}

status_t toStatusT(c2_status_t c2s, c2_operation_t c2op) {
    // C2_OK is always translated to OK.
    if (c2s == C2_OK) {
+13 −0
Original line number Diff line number Diff line
@@ -207,7 +207,20 @@ public:

    void setMetaMode(MetaMode mode);

    /**
     * get pixel format from output buffers.
     *
     * @return 0 if no valid pixel format found.
     */
    uint32_t getBuffersPixelFormat(bool isEncoder);

    void resetBuffersPixelFormat(bool isEncoder);

private:
    uint32_t getInputBuffersPixelFormat();

    uint32_t getOutputBuffersPixelFormat();

    class QueueGuard;

    /**
Loading