static void __mmplayer_initialize_storage_info(mm_player_t* player, MMPlayerPathType path_type);
static void __mmplayer_get_metadata_360_from_tags(GstTagList *tags, mm_player_spherical_metadata_t *metadata);
static int __resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res, void *user_data);
+static void __mmplayer_gst_handle_async(mm_player_t* player, gboolean async, enum MMPlayerSinkType type);
/*===========================================================================================
| |
if (is_drop) {
LOGD("Drop subtitle text after getting EOS\n");
- g_object_set(textbin[MMPLAYER_T_FAKE_SINK].gst, "async", FALSE, NULL);
+ __mmplayer_gst_handle_async(player, FALSE, MMPLAYER_TEXT_SINK);
g_object_set(textbin[MMPLAYER_T_IDENTITY].gst, "drop-probability", (gfloat)1.0, NULL);
player->is_subtitle_force_drop = TRUE;
LOGD("Enable subtitle data path without drop\n");
g_object_set(textbin[MMPLAYER_T_IDENTITY].gst, "drop-probability", (gfloat)0.0, NULL);
- g_object_set(textbin[MMPLAYER_T_FAKE_SINK].gst, "async", TRUE, NULL);
+ __mmplayer_gst_handle_async(player, TRUE, MMPLAYER_TEXT_SINK);
LOGD("non-connected with external display");
goto ERROR;
}
- g_object_set(G_OBJECT(fakesink), "async", TRUE, NULL);
g_object_set(G_OBJECT(fakesink), "sync", TRUE, NULL);
gst_element_set_state(fakesink, GST_STATE_PAUSED);
G_CALLBACK(__mmplayer_update_subtitle),
(gpointer)player);
- g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "async", TRUE, NULL);
g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "sync", TRUE, NULL);
g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "signal-handoffs", TRUE, NULL);
return ret;
}
+static void __mmplayer_gst_handle_async(mm_player_t* player, gboolean async, enum MMPlayerSinkType type)
+{
+ MMPlayerGstElement *videobin = NULL, *audiobin = NULL, *textbin = NULL;
+
+ MMPLAYER_RETURN_IF_FAIL(player && player->pipeline);
+
+ audiobin = player->pipeline->audiobin; /* can be null */
+ videobin = player->pipeline->videobin; /* can be null */
+ textbin = player->pipeline->textbin; /* can be null */
+
+ LOGD("Async will be set to %d about 0x%X type sink", async, type);
+
+ if ((type & MMPLAYER_AUDIO_SINK) && audiobin && audiobin[MMPLAYER_A_SINK].gst)
+ g_object_set(audiobin[MMPLAYER_A_SINK].gst, "async", async, NULL);
+
+ if ((type & MMPLAYER_VIDEO_SINK) && videobin && videobin[MMPLAYER_V_SINK].gst)
+ g_object_set(videobin[MMPLAYER_V_SINK].gst, "async", async, NULL);
+
+ if ((type & MMPLAYER_TEXT_SINK) && textbin && textbin[MMPLAYER_T_FAKE_SINK].gst)
+ g_object_set(textbin[MMPLAYER_T_FAKE_SINK].gst, "async", async, NULL);
+
+ return;
+}
+
static int __gst_realize(mm_player_t* player)
{
gint timeout = 0;
gboolean rewind = FALSE;
gint timeout = 0;
int ret = MM_ERROR_NONE;
- gboolean async = FALSE;
MMPLAYER_FENTER();
(player->streaming_type == STREAMING_SERVICE_VOD && player->videodec_linked))
rewind = TRUE;
- if (player->es_player_push_mode)
- async = TRUE;
+ if (player->es_player_push_mode || MMPLAYER_IS_HTTP_PD(player)) {
+ /* disable the async state transition because there could be no data in the pipeline */
+ __mmplayer_gst_handle_async(player, FALSE, MMPLAYER_SINK_ALL);
+ }
+
/* set gst state */
- ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED, async, timeout);
+ ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED, FALSE, timeout);
+
+ if (player->es_player_push_mode || MMPLAYER_IS_HTTP_PD(player)) {
+ /* enable the async state transition as default operation */
+ __mmplayer_gst_handle_async(player, TRUE, MMPLAYER_SINK_ALL);
+ }
/* return if set_state has failed */
if (ret != MM_ERROR_NONE) {
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_RETURN_VAL_IF_FAIL(timeout, MM_ERROR_COMMON_INVALID_ARGUMENT);
- if (MMPLAYER_IS_STREAMING(player))
+ if (MMPLAYER_IS_HTTP_PD(player))
+ *timeout = player->ini.live_state_change_timeout*2;
+ else if (MMPLAYER_IS_STREAMING(player))
*timeout = player->ini.live_state_change_timeout;
else
*timeout = player->ini.localplayback_state_change_timeout;