Corrections to State checks of pause [Sync with 2.4]. 59/49259/1
authorMahesh Kondiparthi <kd.mahesh@samsung.com>
Mon, 12 Oct 2015 05:53:03 +0000 (11:23 +0530)
committerMahesh Kondiparthi <kd.mahesh@samsung.com>
Mon, 12 Oct 2015 05:54:26 +0000 (11:24 +0530)
    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 <kd.mahesh@samsung.com>
src/mediamuxer.c
src/port_gst/mediamuxer_port_gst.c

index 6618f5b..d3a1b4a 100644 (file)
@@ -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)",
index 0466e42..bfaa39a 100644 (file)
@@ -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;
        }