From 9cc3fc0162c967850c1db6ee468e66189e719fdd Mon Sep 17 00:00:00 2001 From: Sunghyun Eum Date: Tue, 7 May 2013 20:44:18 +0900 Subject: [PATCH] modify to post error when error is occured after eos Change-Id: I5e80526653cf5f5e11616cb4e0a06db1577a0805 --- omx/gstomx_base_filter.c | 25 +++++++++++++++++++++---- omx/gstomx_util.c | 16 +++++++++++++--- omx/gstomx_util.h | 5 +++++ packaging/gst-openmax.spec | 2 +- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c index f4b72c4..e42e5c4 100644 --- a/omx/gstomx_base_filter.c +++ b/omx/gstomx_base_filter.c @@ -217,8 +217,14 @@ out_flushing: } if (error_msg) { - GST_ELEMENT_ERROR (self, STREAM, FAILED, (NULL), ("%s", error_msg)); - ret = GST_FLOW_ERROR; + if (gomx->post_gst_element_error == FALSE) { + GST_ERROR_OBJECT (self, "post GST_ELEMENT_ERROR as %s", error_msg); + GST_ELEMENT_ERROR (self, STREAM, FAILED, (NULL), ("%s", error_msg)); + gomx->post_gst_element_error = TRUE; + ret = GST_FLOW_ERROR; + } else { + GST_ERROR_OBJECT (self, "GST_ELEMENT_ERROR is already posted. skip this (%s)", error_msg); + } } if (buf) @@ -246,6 +252,9 @@ change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: GST_INFO_OBJECT (self, "GST_STATE_CHANGE_NULL_TO_READY"); + core->omx_unrecover_err_cnt = 0; + core->post_gst_element_error = FALSE; + if (core->omx_state != OMX_StateLoaded) { ret = GST_STATE_CHANGE_FAILURE; goto leave; @@ -327,6 +336,8 @@ change_state (GstElement * element, GstStateChange transition) g_object_unref(self->adapter); self->adapter = NULL; } + core->omx_unrecover_err_cnt = 0; + core->post_gst_element_error = FALSE; break; default: @@ -970,8 +981,14 @@ out_flushing: } if (error_msg) { - GST_ELEMENT_ERROR (self, STREAM, FAILED, (NULL), ("%s", error_msg)); - ret = GST_FLOW_ERROR; + if (gomx->post_gst_element_error == FALSE) { + GST_ERROR_OBJECT (self, "post GST_ELEMENT_ERROR as %s", error_msg); + GST_ELEMENT_ERROR (self, STREAM, FAILED, (NULL), ("%s", error_msg)); + gomx->post_gst_element_error = TRUE; + ret = GST_FLOW_ERROR; + } else { + GST_ERROR_OBJECT (self, "GST_ELEMENT_ERROR is already posted. skip this (%s)", error_msg); + } } if (self->adapter_size > 0 && adapter_buf) { diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c index 2783b6b..65abddc 100644 --- a/omx/gstomx_util.c +++ b/omx/gstomx_util.c @@ -920,16 +920,26 @@ EventHandler (OMX_HANDLETYPE omx_handle, /* 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); + GST_WARNING_OBJECT (core->object, "do not send g_cond_signal when MFC init fail. (%d)", + core->omx_unrecover_err_cnt); + if (core->omx_unrecover_err_cnt == 0) { + if (core->post_gst_element_error == FALSE) { + GST_ERROR_OBJECT (core->object, "post GST_ELEMENT_ERROR as Error from OpenMAX component"); + GST_ELEMENT_ERROR (core->object, STREAM, FAILED, (NULL), ("%s", "Error from OpenMAX component")); + core->post_gst_element_error = TRUE; + } else { + GST_ERROR_OBJECT (core->object, "GST_ELEMENT_ERROR is already posted. skip this (Error from OpenMAX component)"); + } + } 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"); + GST_WARNING_OBJECT (core->object, "got unrecoverable error too much. go to omx pause state"); g_omx_core_pause(core); + core->omx_unrecover_err_cnt = 0; } break; } diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h index ee72653..ae30a14 100644 --- a/omx/gstomx_util.h +++ b/omx/gstomx_util.h @@ -107,10 +107,15 @@ struct GOmxCore gchar *library_name; gchar *component_name; gchar *component_role; + /* MODIFICATION: omx vender */ GOmxVendor component_vendor; + /* MODIFICATION: handle continuous MFC init fails */ gint omx_unrecover_err_cnt; + + /* MODIFICATION: to do GST_ELEMENT_ERROR only one time */ + gboolean post_gst_element_error; }; struct GOmxPort diff --git a/packaging/gst-openmax.spec b/packaging/gst-openmax.spec index e1af246..2820219 100644 --- a/packaging/gst-openmax.spec +++ b/packaging/gst-openmax.spec @@ -2,7 +2,7 @@ Name: gst-openmax Summary: GStreamer plug-in that allows communication with OpenMAX IL components Version: 0.10.1 -Release: 6 +Release: 7 Group: Application/Multimedia License: LGPLv2.1 Source0: %{name}-%{version}.tar.gz -- 2.7.4