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

Commit 00beaa27 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

media: Fix graphic buffer leak.

Bug: 30882996
Test: build and boot
Change-Id: I673c06b225f55f0d9f15800edb8113abc237c4ce
Merged-In: I571a3a9d1705233029abb92f3752416d55ed1056
parent 8a288e1f
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -921,11 +921,12 @@ int GraphicBufferSource::findMatchingCodecBuffer_l(
 * frameNum: frame number of the frame being released
 * frameNum: frame number of the frame being released
 * buffer: GraphicBuffer pointer to release (note this must not be & as we
 * buffer: GraphicBuffer pointer to release (note this must not be & as we
 *         will clear the original mBufferSlot in persistent case)
 *         will clear the original mBufferSlot in persistent case)
 *         Use NOLINT to supress warning on the copy of 'buffer'.
 * fence: fence of the frame being released
 * fence: fence of the frame being released
 */
 */
void GraphicBufferSource::releaseBuffer(
void GraphicBufferSource::releaseBuffer(
        int &id, uint64_t frameNum,
        int &id, uint64_t frameNum,
        const sp<GraphicBuffer> &buffer, const sp<Fence> &fence) {
        const sp<GraphicBuffer> buffer, const sp<Fence> &fence) {  // NOLINT
    if (mIsPersistent) {
    if (mIsPersistent) {
        mConsumer->detachBuffer(id);
        mConsumer->detachBuffer(id);
        mBufferSlot[id] = NULL;
        mBufferSlot[id] = NULL;
+1 −1
Original line number Original line Diff line number Diff line
@@ -242,7 +242,7 @@ private:
    // Release buffer to the consumer
    // Release buffer to the consumer
    void releaseBuffer(
    void releaseBuffer(
            int &id, uint64_t frameNum,
            int &id, uint64_t frameNum,
            const sp<GraphicBuffer> &buffer, const sp<Fence> &fence);
            const sp<GraphicBuffer> buffer, const sp<Fence> &fence);


    void setLatestBuffer_l(const BufferItem &item, bool dropped);
    void setLatestBuffer_l(const BufferItem &item, bool dropped);
    bool repeatLatestBuffer_l();
    bool repeatLatestBuffer_l();