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

Commit 2ed42aea authored by Jon Larimer's avatar Jon Larimer Committed by Android (Google) Code Review
Browse files

Merge "do not dequeue from native window after we hit fatal error -- DO NOT MERGE" into klp-dev

parents 0d46c937 734e65e6
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -188,6 +188,7 @@ private:
    bool mSentFormat;
    bool mSentFormat;
    bool mIsEncoder;
    bool mIsEncoder;
    bool mUseMetadataOnEncoderOutput;
    bool mUseMetadataOnEncoderOutput;
    bool mFatalError;
    bool mShutdownInProgress;
    bool mShutdownInProgress;
    bool mIsConfiguredForAdaptivePlayback;
    bool mIsConfiguredForAdaptivePlayback;


+10 −0
Original line number Original line Diff line number Diff line
@@ -362,6 +362,7 @@ ACodec::ACodec()
      mSentFormat(false),
      mSentFormat(false),
      mIsEncoder(false),
      mIsEncoder(false),
      mUseMetadataOnEncoderOutput(false),
      mUseMetadataOnEncoderOutput(false),
      mFatalError(false),
      mShutdownInProgress(false),
      mShutdownInProgress(false),
      mIsConfiguredForAdaptivePlayback(false),
      mIsConfiguredForAdaptivePlayback(false),
      mEncoderDelay(0),
      mEncoderDelay(0),
@@ -812,6 +813,12 @@ ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() {
    ANativeWindowBuffer *buf;
    ANativeWindowBuffer *buf;
    int fenceFd = -1;
    int fenceFd = -1;
    CHECK(mNativeWindow.get() != NULL);
    CHECK(mNativeWindow.get() != NULL);

    if (mFatalError) {
        ALOGW("not dequeuing from native window due to fatal error");
        return NULL;
    }

    if (native_window_dequeue_buffer_and_wait(mNativeWindow.get(), &buf) != 0) {
    if (native_window_dequeue_buffer_and_wait(mNativeWindow.get(), &buf) != 0) {
        ALOGE("dequeueBuffer failed.");
        ALOGE("dequeueBuffer failed.");
        return NULL;
        return NULL;
@@ -2692,6 +2699,9 @@ void ACodec::signalError(OMX_ERRORTYPE error, status_t internalError) {
    sp<AMessage> notify = mNotify->dup();
    sp<AMessage> notify = mNotify->dup();
    notify->setInt32("what", ACodec::kWhatError);
    notify->setInt32("what", ACodec::kWhatError);
    notify->setInt32("omx-error", error);
    notify->setInt32("omx-error", error);

    mFatalError = true;

    notify->setInt32("err", internalError);
    notify->setInt32("err", internalError);
    notify->post();
    notify->post();
}
}