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

Commit ddbafa47 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "FrameDecoder: check source state" into main am: 4ffbf95d

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

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

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

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

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