add max unrecoverable error count
authorSunghyun Eum <sunghyun.eum@samsung.com>
Mon, 8 Apr 2013 13:28:43 +0000 (22:28 +0900)
committerSunghyun Eum <sunghyun.eum@samsung.com>
Mon, 8 Apr 2013 13:28:58 +0000 (22:28 +0900)
Change-Id: Ia649a22f9dddcca302faeebf0cf403171f6afcb2

omx/gstomx_base_filter.c
omx/gstomx_util.c
omx/gstomx_util.h
packaging/gst-openmax.spec

index 4bf8111..8f4973e 100644 (file)
@@ -261,6 +261,9 @@ change_state (GstElement * element, GstStateChange transition)
 
     case GST_STATE_CHANGE_READY_TO_PAUSED:
       GST_INFO_OBJECT (self, "GST_STATE_CHANGE_READY_TO_PAUSED");
+
+      core->omx_unrecover_err_cnt = 0;
+
       /* MODIFICATION: state tuning */
       if (self->use_state_tuning) {
         GST_INFO_OBJECT (self, "use state-tuning feature");
index 417c19d..2783b6b 100644 (file)
@@ -765,9 +765,15 @@ wait_for_state (GOmxCore * core, OMX_STATETYPE state)
   gboolean signaled;
 
   g_mutex_lock (core->omx_state_mutex);
-
-  if (core->omx_error != OMX_ErrorNone)
-    goto leave;
+  if (core->omx_error != OMX_ErrorNone) {
+    /* MODIFICATION: ignore init fail to stop. */
+    if (core->component_vendor == GOMX_VENDOR_SLSI &&
+        core->omx_error == OMX_ErrorMFCInit) {
+      GST_LOG_OBJECT (core->object, "ignore init fail when going to stop");
+    } else {
+      goto leave;
+    }
+  }
 
   g_get_current_time (&tv);
   g_time_val_add (&tv, 15 * G_USEC_PER_SEC);
@@ -911,8 +917,20 @@ EventHandler (OMX_HANDLETYPE omx_handle,
       g_omx_core_flush_start (core);
       /* unlock wait_for_state */
       g_mutex_lock (core->omx_state_mutex);
-      g_cond_signal (core->omx_state_condition);
+      /* MODIFICATION: set to ignore condition signal to stop. */
+      if (core->component_vendor == GOMX_VENDOR_SLSI &&
+          core->omx_error == OMX_ErrorMFCInit) {
+        GST_WARNING_OBJECT (core->object, "do not send g_cond_signal when MFC init fail. (%d)", core->omx_unrecover_err_cnt);
+        core->omx_unrecover_err_cnt++;
+      } else {
+        g_cond_signal (core->omx_state_condition);
+      }
       g_mutex_unlock (core->omx_state_mutex);
+
+      if (core->omx_unrecover_err_cnt >= OMX_UNRECOVERABLE_ERROR_MAX_COUNT) {
+        GST_WARNING_OBJECT (core->object, "got unrecoverable error 10 times. go to omx pause state");
+        g_omx_core_pause(core);
+      }
       break;
     }
     default:
index e547f63..ee72653 100644 (file)
@@ -43,6 +43,10 @@ typedef enum GOmxVendor GOmxVendor;
 typedef void (*GOmxCb) (GOmxCore * core);
 typedef void (*GOmxPortCb) (GOmxPort * port);
 
+/* MODIFICATION: ignore init fail when going to stop. for S.LSI case.*/
+#define OMX_ErrorMFCInit 0x90000004
+#define OMX_UNRECOVERABLE_ERROR_MAX_COUNT 10
+
 /* Enums. */
 
 enum GOmxPortType
@@ -105,6 +109,8 @@ struct GOmxCore
   gchar *component_role;
   /* MODIFICATION: omx vender */
   GOmxVendor component_vendor;
+
+  gint omx_unrecover_err_cnt;
 };
 
 struct GOmxPort
index 876676c..41f8399 100644 (file)
@@ -2,7 +2,7 @@
 Name:       gst-openmax
 Summary:    GStreamer plug-in that allows communication with OpenMAX IL components
 Version:    0.10.1
-Release:    4
+Release:    5
 Group:      Application/Multimedia
 License:    LGPLv2.1
 Source0:    %{name}-%{version}.tar.gz