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

Commit ce9bdb05 authored by Angelo G. Del Regno's avatar Angelo G. Del Regno Committed by Mohammed Althaf T
Browse files

stagefright: Fix buffer handle retrieval in signalBufferReturned



In commit 3e328782 the stagefright code was restructured to fix
the logic for native handle source, but the change in the
function SurfaceMediaSource::signalBufferReturned was probably
missed.

Try to compare the media buffer handle also to the current native
buffer handle in this function when searching for correspondance.

Change-Id: I352293e525f75dde500ac8e71ee49209710030c3
Signed-off-by: default avatarDennySPb <dennyspb@gmail.com>
parent 28bb37be
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -389,9 +389,12 @@ void SurfaceMediaSource::signalBufferReturned(MediaBufferBase *buffer) {
    Mutex::Autolock lock(mMutex);

    buffer_handle_t bufferHandle = getMediaBufferHandle(buffer);
    ANativeWindowBuffer* curNativeHandle = NULL;

    for (size_t i = 0; i < mCurrentBuffers.size(); i++) {
        if (mCurrentBuffers[i]->handle == bufferHandle) {
        curNativeHandle = mCurrentBuffers[i]->getNativeBuffer();
        if ((mCurrentBuffers[i]->handle == bufferHandle) ||
            ((buffer_handle_t)curNativeHandle == bufferHandle)) {
            mCurrentBuffers.removeAt(i);
            foundBuffer = true;
            break;
@@ -407,7 +410,10 @@ void SurfaceMediaSource::signalBufferReturned(MediaBufferBase *buffer) {
            continue;
        }

        if (bufferHandle == mSlots[id].mGraphicBuffer->handle) {
        curNativeHandle = mSlots[id].mGraphicBuffer->getNativeBuffer();

        if ((bufferHandle == mSlots[id].mGraphicBuffer->handle) ||
            (bufferHandle == (buffer_handle_t)curNativeHandle)) {
            ALOGV("Slot %d returned, matches handle = %p", id,
                    mSlots[id].mGraphicBuffer->handle);