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

Author: Shalaj Jain <shalajj@codeaurora.org>

Bug: 70919418
Test: AdaptivePlaybackTest#testXXX_adaptiveEosFlushSeek
Change-Id: Iba746372da7388cf065cf91a1ff668dc01f833ad
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 45c7fb9..2b62968 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -7921,6 +7921,10 @@
                             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 "