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

Commit 4ca35070 authored by Wonsik Kim's avatar Wonsik Kim
Browse files

codec2: fix codec2 cmd line tool

Test: adb shell codec2 /sdcard/a.mp4
Change-Id: I8128ee3979c00fb6d62fa3933f26d9b875865f5b
parent 271a786d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -875,7 +875,6 @@ status_t C2SoftAvcDec::initDecoder() {
            ALOGE("Error in create: 0x%x",
                    s_create_op.s_ivd_create_op_t.u4_error_code);
            deInitDecoder();
            mCodecCtx = NULL;
            return UNKNOWN_ERROR;
        }
    }
@@ -914,6 +913,7 @@ status_t C2SoftAvcDec::deInitDecoder() {
                    s_delete_op.s_ivd_delete_op_t.u4_error_code);
            return UNKNOWN_ERROR;
        }
        mCodecCtx = NULL;
    }

    mChangingResolution = false;
+32 −26
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ SimplePlayer::~SimplePlayer() {

void SimplePlayer::onWorkDone(
        std::weak_ptr<C2Component> component, std::vector<std::unique_ptr<C2Work>> workItems) {
    ALOGV("SimplePlayer::onWorkDone");
    (void) component;
    ULock l(mProcessedLock);
    for (auto & item : workItems) {
@@ -245,7 +246,9 @@ void SimplePlayer::play(const sp<IMediaSource> &source) {
            }
            int slot;
            sp<Fence> fence;
            ALOGV("Render: Frame #%" PRId64, work->worklets.front()->output.ordinal.frame_index);
            const std::shared_ptr<C2Buffer> &output = work->worklets.front()->output.buffers[0];
            if (output) {
                const C2ConstGraphicBlock &block = output->data().graphicBlocks().front();
                sp<GraphicBuffer> buffer(new GraphicBuffer(
                        block.handle(),
@@ -270,6 +273,7 @@ void SimplePlayer::play(const sp<IMediaSource> &source) {
                        0);
                IGraphicBufferProducer::QueueBufferOutput qbo;
                err = igbp->queueBuffer(slot, qbi, &qbo);
            }

            work->input.buffers.clear();
            work->worklets.clear();
@@ -278,6 +282,7 @@ void SimplePlayer::play(const sp<IMediaSource> &source) {
            mWorkQueue.push_back(std::move(work));
            mQueueCondition.notify_all();
        }
        ALOGV("render loop finished");
    });

    long numFrames = 0;
@@ -365,11 +370,12 @@ void SimplePlayer::play(const sp<IMediaSource> &source) {

        ++numFrames;
    }
    ALOGV("main loop finished");
    source->stop();
    component->release();

    running.store(false);
    surfaceThread.join();

    component->release();
    printf("\n");
}