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

Commit 0c9aa1b6 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Separate the notion of "stop" from that of "release", i.e."

parents b290caaf 4484bdd2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -396,7 +396,7 @@ status_t SimplePlayer::onReset() {
    for (size_t i = 0; i < mStateByTrackIndex.size(); ++i) {
        CodecState *state = &mStateByTrackIndex.editValueAt(i);

        CHECK_EQ(state->mCodec->stop(), (status_t)OK);
        CHECK_EQ(state->mCodec->release(), (status_t)OK);
    }

    mStartTimeRealUs = -1ll;
+1 −1
Original line number Diff line number Diff line
@@ -295,7 +295,7 @@ static int decode(
    for (size_t i = 0; i < stateByTrack.size(); ++i) {
        CodecState *state = &stateByTrack.editValueAt(i);

        CHECK_EQ((status_t)OK, state->mCodec->stop());
        CHECK_EQ((status_t)OK, state->mCodec->release());
    }

    return 0;
+9 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ struct ACodec : public AHierarchicalStateMachine {
    void initiateSetup(const sp<AMessage> &msg);
    void signalFlush();
    void signalResume();
    void initiateShutdown();
    void initiateShutdown(bool keepComponentAllocated = false);

    void initiateAllocateComponent(const sp<AMessage> &msg);
    void initiateConfigureComponent(const sp<AMessage> &msg);
@@ -61,6 +61,7 @@ protected:
private:
    struct BaseState;
    struct UninitializedState;
    struct LoadedState;
    struct LoadedToIdleState;
    struct IdleToExecutingState;
    struct ExecutingState;
@@ -107,6 +108,7 @@ private:
    sp<AMessage> mNotify;

    sp<UninitializedState> mUninitializedState;
    sp<LoadedState> mLoadedState;
    sp<LoadedToIdleState> mLoadedToIdleState;
    sp<IdleToExecutingState> mIdleToExecutingState;
    sp<ExecutingState> mExecutingState;
@@ -131,6 +133,12 @@ private:
    bool mSentFormat;
    bool mIsEncoder;

    bool mShutdownInProgress;

    // If "mKeepComponentAllocated" we only transition back to Loaded state
    // and do not release the component instance.
    bool mKeepComponentAllocated;

    status_t allocateBuffersOnPort(OMX_U32 portIndex);
    status_t freeBuffersOnPort(OMX_U32 portIndex);
    status_t freeBuffer(OMX_U32 portIndex, size_t i);
+9 −0
Original line number Diff line number Diff line
@@ -53,8 +53,15 @@ struct MediaCodec : public AHandler {
            uint32_t flags);

    status_t start();

    // Returns to a state in which the component remains allocated but
    // unconfigured.
    status_t stop();

    // Client MUST call release before releasing final reference to this
    // object.
    status_t release();

    status_t flush();

    status_t queueInputBuffer(
@@ -97,6 +104,7 @@ private:
        STARTED,
        FLUSHING,
        STOPPING,
        RELEASING,
    };

    enum {
@@ -109,6 +117,7 @@ private:
        kWhatConfigure                  = 'conf',
        kWhatStart                      = 'strt',
        kWhatStop                       = 'stop',
        kWhatRelease                    = 'rele',
        kWhatDequeueInputBuffer         = 'deqI',
        kWhatQueueInputBuffer           = 'queI',
        kWhatDequeueOutputBuffer        = 'deqO',
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ status_t JMediaCodec::initCheck() const {
}

JMediaCodec::~JMediaCodec() {
    mCodec->stop();
    mCodec->release();

    JNIEnv *env = AndroidRuntime::getJNIEnv();

Loading