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

Commit 4ffbf95d authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "FrameDecoder: check source state" into main

parents 3554f4eb a9bad9f4
Loading
Loading
Loading
Loading
+11 −4
Original line number Original line Diff line number Diff line
@@ -391,7 +391,8 @@ FrameDecoder::FrameDecoder(
      mDstFormat(OMX_COLOR_Format16bitRGB565),
      mDstFormat(OMX_COLOR_Format16bitRGB565),
      mDstBpp(2),
      mDstBpp(2),
      mHaveMoreInputs(true),
      mHaveMoreInputs(true),
      mFirstSample(true) {
      mFirstSample(true),
      mSourceStopped(false) {
}
}


FrameDecoder::~FrameDecoder() {
FrameDecoder::~FrameDecoder() {
@@ -401,9 +402,11 @@ FrameDecoder::~FrameDecoder() {
    }
    }
    if (mDecoder != NULL) {
    if (mDecoder != NULL) {
        mDecoder->release();
        mDecoder->release();
        if (!mSourceStopped) {
            mSource->stop();
            mSource->stop();
        }
        }
    }
    }
}


bool isHDR(const sp<AMessage> &format) {
bool isHDR(const sp<AMessage> &format) {
    uint32_t standard, transfer;
    uint32_t standard, transfer;
@@ -706,8 +709,12 @@ status_t FrameDecoder::extractInternalUsingBlockModel() {


    // wait for handleOutputBufferAsync() to finish
    // wait for handleOutputBufferAsync() to finish
    std::unique_lock _lk(mMutex);
    std::unique_lock _lk(mMutex);
    mOutputFramePending.wait_for(_lk, std::chrono::microseconds(kAsyncBufferTimeOutUs),
    if (!mOutputFramePending.wait_for(_lk, std::chrono::microseconds(kAsyncBufferTimeOutUs),
                                 [this] { return mHandleOutputBufferAsyncDone; });
                                 [this] { return mHandleOutputBufferAsyncDone; })) {
        ALOGE("%s timed out waiting for handleOutputBufferAsync() to complete.", __func__);
        mSource->stop();
        mSourceStopped = true;
    }
    return mHandleOutputBufferAsyncDone ? OK : TIMED_OUT;
    return mHandleOutputBufferAsyncDone ? OK : TIMED_OUT;
}
}


+1 −0
Original line number Original line Diff line number Diff line
@@ -120,6 +120,7 @@ private:
    sp<ALooper> mAsyncLooper;
    sp<ALooper> mAsyncLooper;
    bool mHaveMoreInputs;
    bool mHaveMoreInputs;
    bool mFirstSample;
    bool mFirstSample;
    bool mSourceStopped;
    bool mHandleOutputBufferAsyncDone;
    bool mHandleOutputBufferAsyncDone;
    sp<Surface> mSurface;
    sp<Surface> mSurface;
    std::mutex mMutex;
    std::mutex mMutex;