ignore buffering msg during ready state 85/78885/2 accepted/tizen/common/20160707.172120 submit/tizen/20160707.103558
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 7 Jul 2016 08:26:26 +0000 (17:26 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 7 Jul 2016 10:24:41 +0000 (19:24 +0900)
Change-Id: I6e44633907796d61d708430d1235b40addae6f7d

packaging/libmm-player.spec
src/mm_player_priv.c
src/mm_player_resource.c

index e935fa8..fab2987 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.5.88
+Version:    0.5.89
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index eaa341b..a84cb77 100644 (file)
@@ -1485,6 +1485,13 @@ __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data) // @
                        if (!MMPLAYER_IS_STREAMING(player))
                                break;
 
+                       /* ignore the buffering messages during building pipeline, *
+                        * not to block the main loop                              */
+                       if (MMPLAYER_CURRENT_STATE(player) <= MM_PLAYER_STATE_READY) {
+                               LOGW("ignore the buffering msg (state:%d)", MMPLAYER_CURRENT_STATE(player));
+                               break;
+                       }
+
                        /* ignore the prev buffering message */
                        if ((player->streamer) && (player->streamer->is_buffering == FALSE) && (player->streamer->is_buffering_done == TRUE))
                        {
@@ -2644,6 +2651,23 @@ __mmplayer_gst_decode_pad_added (GstElement *elem, GstPad *pad, gpointer data)
                if (stype == MM_DISPLAY_SURFACE_NULL || stype == MM_DISPLAY_SURFACE_REMOTE)
                {
                        LOGD ("no video sink by null surface or multiple track");
+                       MMPlayerResourceState resource_state = RESOURCE_STATE_NONE;
+                       if (_mmplayer_resource_manager_get_state(&player->resource_manager, &resource_state)
+                                       == MM_ERROR_NONE)
+                       {
+                               /* acquire resources for video playing */
+                               if (resource_state >= RESOURCE_STATE_PREPARED)
+                               {
+                                       if (_mmplayer_resource_manager_acquire(&player->resource_manager)
+                                                       != MM_ERROR_NONE)
+                                       {
+                                               LOGE("could not acquire resources for video playing\n");
+                                               _mmplayer_resource_manager_unprepare(&player->resource_manager);
+                                               goto ERROR;
+                                       }
+                               }
+                       }
+
                        gchar *caps_str = gst_caps_to_string(caps);
                        if (strstr(caps_str, "ST12") || strstr(caps_str, "SN12"))
                        {
index b218fee..0ef7d68 100644 (file)
@@ -413,7 +413,6 @@ int _mmplayer_resource_manager_acquire(MMPlayerResourceManager *resource_manager
                                LOGE("- could not acquire resource, ret(%d)\n", ret);
                                ret = MM_ERROR_RESOURCE_INTERNAL;
                        }
-#if 0 /* Fix me: Disable below logic temporarily */
                        else
                        {
                                gint64 end_time = g_get_monotonic_time() + MMPLAYER_RESOURCE_ACQUIRE_TIMEOUT*G_TIME_SPAN_SECOND;
@@ -427,8 +426,6 @@ int _mmplayer_resource_manager_acquire(MMPlayerResourceManager *resource_manager
                                        LOGD("- resources are acquired\n");
                                }
                        }
-#endif
-
                        MMPLAYER_RESOURCE_UNLOCK(resource_manager);
                }
        }