From: Mahesh Kondiparthi Date: Mon, 12 Oct 2015 05:53:03 +0000 (+0530) Subject: Corrections to State checks of pause [Sync with 2.4]. X-Git-Tag: accepted/tizen/mobile/20151207.123258~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F59%2F49259%2F1;p=platform%2Fcore%2Fapi%2Fmediamuxer.git Corrections to State checks of pause [Sync with 2.4]. Corrected improper State check for mx_pause call pause pre-state is restricted to Muxing. Ready is avoided in the state check. Change-Id: I3f14eec9e843efcd5a3906b4e5e269448d8900fc Signed-off-by: Mahesh Kondiparthi --- diff --git a/src/mediamuxer.c b/src/mediamuxer.c index 6618f5b..d3a1b4a 100644 --- a/src/mediamuxer.c +++ b/src/mediamuxer.c @@ -249,9 +249,9 @@ int mediamuxer_pause(mediamuxer_h muxer) int ret = MEDIAMUXER_ERROR_NONE; MUXER_INSTANCE_CHECK(muxer); mediamuxer_s *handle = (mediamuxer_s *)(muxer); - ret = mx_pause(handle->mx_handle); - if (handle->muxer_state == MEDIAMUXER_STATE_READY - || handle->muxer_state == MEDIAMUXER_STATE_MUXING) { + + if (handle->muxer_state == MEDIAMUXER_STATE_MUXING) { + ret = mx_pause(handle->mx_handle); if (ret != MEDIAMUXER_ERROR_NONE) { MX_E ("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)", diff --git a/src/port_gst/mediamuxer_port_gst.c b/src/port_gst/mediamuxer_port_gst.c index 0466e42..bfaa39a 100644 --- a/src/port_gst/mediamuxer_port_gst.c +++ b/src/port_gst/mediamuxer_port_gst.c @@ -1122,13 +1122,14 @@ static int gst_muxer_pause(MMHandleType pHandle) int ret = MX_ERROR_NONE; MEDIAMUXER_CHECK_NULL(pHandle); mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle; - GstState state; + MX_I("gst_muxer_pause setting pipeline to pause"); gst_element_get_state(gst_handle->pipeline, &state, NULL, GST_CLOCK_TIME_NONE); + if (state == GST_STATE_PLAYING) { - if (gst_element_set_state(gst_handle->pipeline, GST_STATE_PAUSED) == - GST_STATE_CHANGE_FAILURE) { + if (gst_element_set_state(gst_handle->pipeline, GST_STATE_PAUSED) + == GST_STATE_CHANGE_FAILURE) { MX_I("Setting pipeline to pause failed"); ret = MX_ERROR_INVALID_ARGUMENT; } @@ -1152,9 +1153,9 @@ static int gst_muxer_resume(MMHandleType pHandle) MEDIAMUXER_CHECK_NULL(pHandle); mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle; - MX_I("gst_muxer_resume setting pipeline to playing"); - if (gst_element_set_state(gst_handle->pipeline, GST_STATE_PLAYING) == - GST_STATE_CHANGE_FAILURE) { + MX_I("gst_muxer_resume setting pipeline back to playing"); + if (gst_element_set_state(gst_handle->pipeline, GST_STATE_PLAYING) + == GST_STATE_CHANGE_FAILURE) { MX_I("Setting pipeline to resume failed"); ret = MX_ERROR_INVALID_ARGUMENT; }