libstagefright: Flush the pending buffers when EOS is received

For the use case where the first frame in the buffer is EOS, decode
the aac config frame buffer to update the sample rate and channel
mode and flush out the buffer.
CRs-Fixed: 459334

Change-Id: I175dc531e00ec36a366a818366fa869cd6ccf5a1
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index 1b20cbb..28f81f2 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -362,9 +362,13 @@
             inInfo->mOwnedByUs = false;
             notifyEmptyBufferDone(inHeader);
 
-            if (mDecoderHasData) {
+            if (mDecoderHasData || mInputBufferCount) {
                 // flush out the decoder's delayed data by calling DecodeFrame
                 // one more time, with the AACDEC_FLUSH flag set
+
+                // for the use case where the first frame in the buffer is EOS,
+                // decode the header to update the sample rate and channel mode
+                // and flush out the buffer.
                 INT_PCM *outBuffer =
                         reinterpret_cast<INT_PCM *>(
                                 outHeader->pBuffer + outHeader->nOffset);