Change MPEG2 reinit Error Handling am: a67eacace7 am: a16f5a1fb3 am: 1c0389cc5f am: 4ff3666a51
am: b56bc9e762
Change-Id: Id27edb4426a7c4c2fad7bac2582663667d58ad75
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;
}