OSDN Git Service

Change MPEG2 reinit Error Handling
authorVenkatarama Avadhani <venkatarama.avadhani@ittiam.com>
Tue, 30 May 2017 10:31:11 +0000 (16:01 +0530)
committerRay Essick <essick@google.com>
Tue, 20 Jun 2017 21:58:14 +0000 (14:58 -0700)
Changing reinit handling to not notify error in case init fails.

Bug: 37237396
Test: ran poc before/after on nyc-mr2
Change-Id: I694a9d2ccee7622d9c736efac12c9ec8639911f4

media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp

index f50f69c..d13fd81 100644 (file)
@@ -80,13 +80,6 @@ SoftMPEG2::SoftMPEG2(
     // 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() {
@@ -456,8 +449,6 @@ status_t SoftMPEG2::reInitDecoder() {
     if (OK != ret) {
         ALOGE("Failed to initialize decoder");
         deInitDecoder();
-        notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
-        mSignalledError = true;
         return ret;
     }
     mSignalledError = false;
@@ -565,6 +556,15 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) {
         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);
 
@@ -629,9 +629,6 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) {
 
             if (OK != reInitDecoder()) {
                 ALOGE("Failed to reinitialize decoder");
-                notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
-                mSignalledError = true;
-                return;
             }
             return;
         }
@@ -705,8 +702,6 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) {
 
                 if (OK != reInitDecoder()) {
                     ALOGE("Failed to reinitialize decoder");
-                    notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL);
-                    mSignalledError = true;
                     return;
                 }