Properly signal an error if codec configuration goes wrong.

previously any error signaled by setupXXX inside ACodec::configureCodec
would be overwritten with the result of setMinBufferSize at the end
of the function.

Change-Id: Id4beb571ca52ea4646239d0af006e09ce1130268
related-to-bug: 7542181
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 0ca027b..84b4962 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -937,7 +937,8 @@
             }
 
             err = setupAACCodec(
-                    encoder, numChannels, sampleRate, bitRate, aacProfile, isADTS != 0);
+                    encoder, numChannels, sampleRate, bitRate, aacProfile,
+                    isADTS != 0);
         }
     } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_NB)) {
         err = setupAMRCodec(encoder, false /* isWAMR */, bitRate);
@@ -986,6 +987,10 @@
         }
     }
 
+    if (err != OK) {
+        return err;
+    }
+
     if (!msg->findInt32("encoder-delay", &mEncoderDelay)) {
         mEncoderDelay = 0;
     }