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

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

Merge "CCodec: refactor pipeline logic"

parents 8f80fadb ab34ed6f
Loading
Loading
Loading
Loading
+16 −25
Original line number Diff line number Diff line
@@ -52,33 +52,26 @@

namespace android {

class C2SoftAacDec::IntfImpl : public C2InterfaceHelper {
constexpr char COMPONENT_NAME[] = "c2.android.aac.decoder";

class C2SoftAacDec::IntfImpl : public SimpleInterface<void>::BaseParams {
public:
    explicit IntfImpl(const std::shared_ptr<C2ReflectorHelper> &helper)
        : C2InterfaceHelper(helper) {

        setDerivedInstance(this);

        addParameter(
                DefineParam(mInputFormat, C2_NAME_INPUT_STREAM_FORMAT_SETTING)
                .withConstValue(new C2StreamFormatConfig::input(0u, C2FormatCompressed))
                .build());

        addParameter(
                DefineParam(mOutputFormat, C2_NAME_OUTPUT_STREAM_FORMAT_SETTING)
                .withConstValue(new C2StreamFormatConfig::output(0u, C2FormatAudio))
                .build());
        : SimpleInterface<void>::BaseParams(
                helper,
                COMPONENT_NAME,
                C2Component::KIND_DECODER,
                C2Component::DOMAIN_AUDIO,
                MEDIA_MIMETYPE_AUDIO_AAC) {
        noPrivateBuffers();
        noInputReferences();
        noOutputReferences();
        noInputLatency();
        noTimeStretch();

        addParameter(
                DefineParam(mInputMediaType, C2_NAME_INPUT_PORT_MIME_SETTING)
                .withConstValue(AllocSharedString<C2PortMimeConfig::input>(
                        MEDIA_MIMETYPE_AUDIO_AAC))
                .build());

        addParameter(
                DefineParam(mOutputMediaType, C2_NAME_OUTPUT_PORT_MIME_SETTING)
                .withConstValue(AllocSharedString<C2PortMimeConfig::output>(
                        MEDIA_MIMETYPE_AUDIO_RAW))
                DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY)
                .withConstValue(new C2PortActualDelayTuning::output(2u))
                .build());

        addParameter(
@@ -231,8 +224,6 @@ private:
    // TODO Add : C2StreamAacSbrModeTuning
};

constexpr char COMPONENT_NAME[] = "c2.android.aac.decoder";

C2SoftAacDec::C2SoftAacDec(
        const char *name,
        c2_node_id_t id,
+8 −0
Original line number Diff line number Diff line
@@ -51,6 +51,12 @@ public:
        noInputLatency();
        noTimeStretch();

        // TODO: Proper support for reorder depth.
        addParameter(
                DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY)
                .withConstValue(new C2PortActualDelayTuning::output(8u))
                .build());

        // TODO: output latency and reordering

        addParameter(
@@ -877,6 +883,8 @@ void C2SoftAvcDec::process(
    } else if (!hasPicture) {
        fillEmptyWork(work);
    }

    work->input.buffers.clear();
}

c2_status_t C2SoftAvcDec::drainInternal(
+5 −1
Original line number Diff line number Diff line
@@ -51,7 +51,11 @@ public:
        noInputLatency();
        noTimeStretch();

        // TODO: output latency and reordering
        // TODO: Proper support for reorder depth.
        addParameter(
                DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY)
                .withConstValue(new C2PortActualDelayTuning::output(8u))
                .build());

        addParameter(
                DefineParam(mAttrib, C2_PARAMKEY_COMPONENT_ATTRIBUTES)
+5 −1
Original line number Diff line number Diff line
@@ -60,7 +60,11 @@ public:
        noInputLatency();
        noTimeStretch();

        // TODO: output latency and reordering
        // TODO: Proper support for reorder depth.
        addParameter(
                DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY)
                .withConstValue(new C2PortActualDelayTuning::output(1u))
                .build());

        addParameter(
                DefineParam(mAttrib, C2_PARAMKEY_COMPONENT_ATTRIBUTES)
+4 −5
Original line number Diff line number Diff line
@@ -55,12 +55,10 @@ struct CodecListener : public android::Codec2Client::Listener {
        : callBack(fn) {}
    virtual void onWorkDone(
        const std::weak_ptr<android::Codec2Client::Component>& comp,
        std::list<std::unique_ptr<C2Work>>& workItems,
        size_t numDiscardedInputBuffers) override {
        std::list<std::unique_ptr<C2Work>>& workItems) override {
        /* TODO */
        ALOGD("onWorkDone called");
        (void)comp;
        (void)numDiscardedInputBuffers;
        if (callBack) callBack(workItems);
    }

@@ -89,9 +87,10 @@ struct CodecListener : public android::Codec2Client::Listener {
    }

    virtual void onInputBufferDone(
        const std::shared_ptr<C2Buffer>& buffer) override {
        uint64_t frameIndex, size_t arrayIndex) override {
        /* TODO */
        (void)buffer;
        (void)frameIndex;
        (void)arrayIndex;
    }

    virtual void onFrameRendered(
Loading