dashplayer: Remove cached formats from the proper location

1. Removed cached format/crop from the 0th position.
2. Clear cached formats in destructor.

Change-Id: Idd9c767bf9f660fe8ceae7f99b3ac51861b2a932
diff --git a/dashplayer/DashCodec.cpp b/dashplayer/DashCodec.cpp
old mode 100644
new mode 100755
index ed2368c..425227d
--- a/dashplayer/DashCodec.cpp
+++ b/dashplayer/DashCodec.cpp
@@ -401,6 +401,7 @@
 }
 
 DashCodec::~DashCodec() {
+  clearCachedFormats();
 }
 
 void DashCodec::setNotificationMessage(const sp<AMessage> &msg) {
@@ -2160,7 +2161,7 @@
     if (mFormats.size() > 0) {
         useCachedConfig = true;
         def = mFormats[0];
-        mFormats.pop();
+        mFormats.removeAt(0);
     } else {
         def = new OMX_PARAM_PORTDEFINITIONTYPE();
         InitOMXParams(def);
@@ -2188,7 +2189,7 @@
             bool hasValidCrop = true;
             if (useCachedConfig) {
                 rect = mOutputCrops[0];
-                mOutputCrops.pop();
+                mOutputCrops.removeAt(0);
                 if (rect == NULL) {
                     rect = new OMX_CONFIG_RECTTYPE();
                     hasValidCrop = false;