[0.6.123] add _abort_pause 45/186945/2
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 16 Aug 2018 12:32:22 +0000 (21:32 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 16 Aug 2018 12:32:29 +0000 (21:32 +0900)
- in case of streaming, pause could take long time.
- to cancle the prepareing by app, it needs to be aborted.

Change-Id: I4be5ab92f3c61b51456a264b5a0d72a077b28a6f

packaging/libmm-player.spec
src/include/mm_player.h
src/include/mm_player_priv.h
src/mm_player.c
src/mm_player_priv.c

index fc6249f..183c54d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.122
+Version:    0.6.123
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index f5ef4c8..b6545ca 100644 (file)
@@ -664,6 +664,12 @@ if (mm_player_unrealize(g_player) != MM_ERROR_NONE) {
 int mm_player_unrealize(MMHandleType player);
 
 /**
+ * This function is to abort pause state transition
+ * for unrealize or destroy.
+ */
+int mm_player_abort_pause(MMHandleType player);
+
+/**
  * This function is to get current state of player. \n
  * Application have to check current state before doing some action.
  *
index 3d1249c..6f2cd08 100644 (file)
@@ -894,6 +894,7 @@ int _mmplayer_get_mute(MMHandleType hplayer, int* pmute);
 int _mmplayer_start(MMHandleType hplayer);
 int _mmplayer_stop(MMHandleType hplayer);
 int _mmplayer_pause(MMHandleType hplayer);
+int _mmplayer_abort_pause(MMHandleType hplayer);
 int _mmplayer_resume(MMHandleType hplayer);
 int _mmplayer_set_position(MMHandleType hplayer, int format, gint64 pos);
 int _mmplayer_get_position(MMHandleType hplayer, int format, gint64 *pos);
index 9fc969d..e289f9a 100644 (file)
@@ -139,6 +139,21 @@ int mm_player_realize(MMHandleType player)
        return result;
 }
 
+int mm_player_abort_pause(MMHandleType player)
+{
+       int result = MM_ERROR_NONE;
+
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+       /* destroy the gst bus msg thread not to be blocked in pause(without cmd lock). */
+       _mmplayer_bus_msg_thread_destroy(player);
+
+       /* abort the pause operation for preparing(without cmd lock). */
+       result = _mmplayer_abort_pause(player);
+
+       return result;
+}
+
 int mm_player_unrealize(MMHandleType player)
 {
        int result = MM_ERROR_NONE;
index 3b8b7bf..8897cfc 100644 (file)
@@ -7028,7 +7028,7 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player)
                                return MM_ERROR_PLAYER_INTERNAL;
                        }
 
-                       LOGW("succeeded in chaning state to NULL\n");
+                       LOGW("succeeded in changing state to NULL\n");
 
                        gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_PIPE].gst));
 
@@ -7372,6 +7372,11 @@ int __gst_pause(mm_player_t* player, gboolean async)
 
                        LOGE("failed to set state to PAUSED");
 
+                       if (!player->bus_watcher) {
+                               LOGE("there is no bus msg thread. pipeline is shutting down.");
+                               return ret;
+                       }
+
                        if (player->msg_posted) {
                                LOGE("error msg is already posted.");
                                return ret;
@@ -7428,8 +7433,7 @@ int __gst_pause(mm_player_t* player, gboolean async)
 
                        return MM_ERROR_PLAYER_CODEC_NOT_FOUND;
 
-               } else if (ret == MM_ERROR_NONE) {
-
+               } else {
                        MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PAUSED);
                }
        }
@@ -9353,6 +9357,35 @@ _mmplayer_pause(MMHandleType hplayer)
        return ret;
 }
 
+/* in case of streaming, pause could take long time.*/
+int
+_mmplayer_abort_pause(MMHandleType hplayer)
+{
+       mm_player_t* player = (mm_player_t*)hplayer;
+       int ret = MM_ERROR_NONE;
+
+       MMPLAYER_FENTER();
+
+       MMPLAYER_RETURN_VAL_IF_FAIL(player &&
+                                               player->pipeline &&
+                                               player->pipeline->mainbin,
+                                               MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+       LOGD("set the pipeline state to READY");
+
+       /* set state to READY */
+       ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
+                                               GST_STATE_READY, FALSE, MMPLAYER_STATE_CHANGE_TIMEOUT(player));
+       if (ret != MM_ERROR_NONE) {
+               LOGE("fail to change state to READY");
+               return MM_ERROR_PLAYER_INTERNAL;
+       }
+
+       LOGD("succeeded in changing state to READY");
+       return ret;
+}
+
+
 int
 _mmplayer_resume(MMHandleType hplayer)
 {