Loading media/libstagefright/omx/GraphicBufferSource.cpp +19 −7 Original line number Original line Diff line number Diff line Loading @@ -954,28 +954,40 @@ void GraphicBufferSource::onBuffersReleased() { Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); uint64_t slotMask; uint64_t slotMask; if (mConsumer->getReleasedBuffers(&slotMask) != NO_ERROR) { uint64_t releaseMask; ALOGW("onBuffersReleased: unable to get released buffer set"); if (mConsumer->getReleasedBuffers(&releaseMask) != NO_ERROR) { slotMask = 0xffffffffffffffffULL; slotMask = 0xffffffffffffffffULL; } ALOGW("onBuffersReleased: unable to get released buffer set"); } else { slotMask = releaseMask; ALOGV("onBuffersReleased: 0x%016" PRIx64, slotMask); ALOGV("onBuffersReleased: 0x%016" PRIx64, slotMask); } AString unpopulated; for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { if ((slotMask & 0x01) != 0) { if ((slotMask & 0x01) != 0) { discardBufferInSlot_l(i); if (!discardBufferInSlot_l(i)) { if (!unpopulated.empty()) { unpopulated.append(", "); } unpopulated.append(i); } } } slotMask >>= 1; slotMask >>= 1; } } if (!unpopulated.empty()) { ALOGW("released unpopulated slots: [%s]", unpopulated.c_str()); } } } void GraphicBufferSource::discardBufferInSlot_l(GraphicBufferSource::slot_id i) { bool GraphicBufferSource::discardBufferInSlot_l(GraphicBufferSource::slot_id i) { ssize_t bsi = mBufferSlots.indexOfKey(i); ssize_t bsi = mBufferSlots.indexOfKey(i); if (bsi < 0) { if (bsi < 0) { ALOGW("releasing an unpopulated slot: %d", i); return false; } else { } else { discardBufferAtSlotIndex_l(bsi); discardBufferAtSlotIndex_l(bsi); mBufferSlots.removeItemsAt(bsi); mBufferSlots.removeItemsAt(bsi); return true; } } } } Loading media/libstagefright/omx/GraphicBufferSource.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -257,8 +257,8 @@ private: void onBufferAcquired_l(const VideoBuffer &buffer); void onBufferAcquired_l(const VideoBuffer &buffer); // marks the buffer at the slot no longer cached, and accounts for the outstanding // marks the buffer at the slot no longer cached, and accounts for the outstanding // acquire count // acquire count. Returns true if the slot was populated; otherwise, false. void discardBufferInSlot_l(slot_id i); bool discardBufferInSlot_l(slot_id i); // marks the buffer at the slot index no longer cached, and accounts for the outstanding // marks the buffer at the slot index no longer cached, and accounts for the outstanding // acquire count // acquire count Loading Loading
media/libstagefright/omx/GraphicBufferSource.cpp +19 −7 Original line number Original line Diff line number Diff line Loading @@ -954,28 +954,40 @@ void GraphicBufferSource::onBuffersReleased() { Mutex::Autolock lock(mMutex); Mutex::Autolock lock(mMutex); uint64_t slotMask; uint64_t slotMask; if (mConsumer->getReleasedBuffers(&slotMask) != NO_ERROR) { uint64_t releaseMask; ALOGW("onBuffersReleased: unable to get released buffer set"); if (mConsumer->getReleasedBuffers(&releaseMask) != NO_ERROR) { slotMask = 0xffffffffffffffffULL; slotMask = 0xffffffffffffffffULL; } ALOGW("onBuffersReleased: unable to get released buffer set"); } else { slotMask = releaseMask; ALOGV("onBuffersReleased: 0x%016" PRIx64, slotMask); ALOGV("onBuffersReleased: 0x%016" PRIx64, slotMask); } AString unpopulated; for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { if ((slotMask & 0x01) != 0) { if ((slotMask & 0x01) != 0) { discardBufferInSlot_l(i); if (!discardBufferInSlot_l(i)) { if (!unpopulated.empty()) { unpopulated.append(", "); } unpopulated.append(i); } } } slotMask >>= 1; slotMask >>= 1; } } if (!unpopulated.empty()) { ALOGW("released unpopulated slots: [%s]", unpopulated.c_str()); } } } void GraphicBufferSource::discardBufferInSlot_l(GraphicBufferSource::slot_id i) { bool GraphicBufferSource::discardBufferInSlot_l(GraphicBufferSource::slot_id i) { ssize_t bsi = mBufferSlots.indexOfKey(i); ssize_t bsi = mBufferSlots.indexOfKey(i); if (bsi < 0) { if (bsi < 0) { ALOGW("releasing an unpopulated slot: %d", i); return false; } else { } else { discardBufferAtSlotIndex_l(bsi); discardBufferAtSlotIndex_l(bsi); mBufferSlots.removeItemsAt(bsi); mBufferSlots.removeItemsAt(bsi); return true; } } } } Loading
media/libstagefright/omx/GraphicBufferSource.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -257,8 +257,8 @@ private: void onBufferAcquired_l(const VideoBuffer &buffer); void onBufferAcquired_l(const VideoBuffer &buffer); // marks the buffer at the slot no longer cached, and accounts for the outstanding // marks the buffer at the slot no longer cached, and accounts for the outstanding // acquire count // acquire count. Returns true if the slot was populated; otherwise, false. void discardBufferInSlot_l(slot_id i); bool discardBufferInSlot_l(slot_id i); // marks the buffer at the slot index no longer cached, and accounts for the outstanding // marks the buffer at the slot index no longer cached, and accounts for the outstanding // acquire count // acquire count Loading