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

Commit 29a142c7 authored by Jamie Gennis's avatar Jamie Gennis
Browse files

SurfaceTexture: add the abandon method.

This change adds the 'abandon' method to the SurfaceTexture C++ class.
This method may be used to put the SurfaceTexture in an abandoned state,
causing all ISurfaceTexture methods to fail.

Change-Id: Ibd261f7b73f44e2bec36a8508bf92113cfb7cf95
parent 85eafc68
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ public:
    // SurfaceMediaSource object (i.e. they are not owned by the client).
    virtual status_t setBufferCount(int bufferCount);

    virtual sp<GraphicBuffer> requestBuffer(int buf);
    virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf);

    // dequeueBuffer gets the next buffer slot index for the client to use. If a
    // buffer slot is available then that slot index is written to the location
+7 −6
Original line number Diff line number Diff line
@@ -147,16 +147,17 @@ status_t SurfaceMediaSource::setBufferCount(int bufferCount) {
    return OK;
}

sp<GraphicBuffer> SurfaceMediaSource::requestBuffer(int buf) {
status_t SurfaceMediaSource::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
    LOGV("SurfaceMediaSource::requestBuffer");
    Mutex::Autolock lock(mMutex);
    if (buf < 0 || mBufferCount <= buf) {
    if (slot < 0 || mBufferCount <= slot) {
        LOGE("requestBuffer: slot index out of range [0, %d]: %d",
                mBufferCount, buf);
        return 0;
                mBufferCount, slot);
        return BAD_VALUE;
    }
    mSlots[buf].mRequestBufferCalled = true;
    return mSlots[buf].mGraphicBuffer;
    mSlots[slot].mRequestBufferCalled = true;
    *buf = mSlots[slot].mGraphicBuffer;
    return NO_ERROR;
}

status_t SurfaceMediaSource::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,