Change MPEG2 reinit Error Handling

Changing reinit handling to not notify error in case init fails.

Bug: 37237396
Test: ran poc before/after on nyc-mr2
Change-Id: I694a9d2ccee7622d9c736efac12c9ec8639911f4
(cherry picked from commit a67eacace769095eb04b01681c99d931e68a4b08)
diff --git a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp
index 634207e..1fac739 100644
--- a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp
+++ b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp
@@ -83,13 +83,6 @@
     // If input dump is enabled, then open create an empty file
     GENERATE_FILE_NAMES();
     CREATE_DUMP_FILE(mInFile);
-
-    if (OK != initDecoder()) {
-        ALOGE("Failed to initialize decoder");
-        notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
-        mSignalledError = true;
-        return;
-    }
 }
 
 SoftMPEG2::~SoftMPEG2() {
@@ -460,8 +453,6 @@
     if (OK != ret) {
         ALOGE("Failed to initialize decoder");
         deInitDecoder();
-        notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
-        mSignalledError = true;
         return ret;
     }
     mSignalledError = false;
@@ -610,6 +601,15 @@
         return;
     }
 
+    if (NULL == mCodecCtx) {
+        if (OK != initDecoder()) {
+            ALOGE("Failed to initialize decoder");
+            notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
+            mSignalledError = true;
+            return;
+        }
+    }
+
     List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex);
     List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
 
@@ -664,9 +664,6 @@
 
             if (OK != reInitDecoder()) {
                 ALOGE("Failed to reinitialize decoder");
-                notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
-                mSignalledError = true;
-                return;
             }
             return;
         }
@@ -742,8 +739,6 @@
 
                 if (OK != reInitDecoder()) {
                     ALOGE("Failed to reinitialize decoder");
-                    notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
-                    mSignalledError = true;
                     return;
                 }