From 2fd815ffc3cac5655d0809bf762400e452734114 Mon Sep 17 00:00:00 2001 From: Shalaj Jain Date: Mon, 25 Jan 2016 13:20:10 -0800 Subject: stagefright: Clear RenderQueue on port settings changed Clear the RenderTracker RenderQueue before allocating new set of buffers during port settings change. The graphicBuffers inside the RenderQueue hold the actual buffer references which prevents them from being freed until this queue is cleared. Do not wait till executing state to clear the queue as then overall memory consumption goes up for the brief period. CRs-Fixed: 972394 Change-Id: If50ffc2d517f793a59c88d3fb213bf4c23b8c9f7 --- media/libstagefright/ACodec.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 8cf38ef..b83d6c6 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -6781,6 +6781,11 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent( mCodec->mNode, OMX_CommandPortEnable, kPortIndexOutput); } + /* Clear the RenderQueue in which queued GraphicBuffers hold the + * actual buffer references in order to free them early. + */ + mCodec->mRenderTracker.clear(systemTime(CLOCK_MONOTONIC)); + if (err == OK) { err = mCodec->allocateBuffersOnPort(kPortIndexOutput); ALOGE_IF(err != OK, "Failed to allocate output port buffers after port " -- cgit v1.1