diff options
author | Gilbok Lee <gilbok.lee@samsung.com> | 2017-08-11 15:18:57 +0900 |
---|---|---|
committer | Eunhae Choi <eunhae1.choi@samsung.com> | 2018-01-29 15:49:04 +0900 |
commit | a06576475bafa707635525a494e91fdc57bc3590 (patch) | |
tree | 99b452d472911388f58dbc9f3ee4b106cf5972f7 | |
parent | ca17327d43b1ca75e57d1644093bf97c0b97124e (diff) | |
download | libmm-player-accepted/tizen_3.0_wearable.tar.gz libmm-player-accepted/tizen_3.0_wearable.tar.bz2 libmm-player-accepted/tizen_3.0_wearable.zip |
[0.6.65] Remove pd watch callback when unrelize pd pipelinesubmit/tizen_3.0/20180130.022618accepted/tizen/3.0/wearable/20180202.052102accepted/tizen/3.0/tv/20180202.052058accepted/tizen/3.0/mobile/20180202.052054accepted/tizen/3.0/common/20180202.113507tizen_3.0accepted/tizen_3.0_wearableaccepted/tizen_3.0_tvaccepted/tizen_3.0_mobileaccepted/tizen_3.0_common
- add pd lock to avoid the deadlock during state change
Change-Id: If2387afb79b8384b46c888cc8826afa98e764a52
(cherry picked from commit ce13f1afa11fdbb6561a3fa9c192d406eb1f127c)
-rw-r--r-- | packaging/libmm-player.spec | 2 | ||||
-rw-r--r-- | src/include/mm_player_pd.h | 2 | ||||
-rw-r--r-- | src/mm_player_pd.c | 19 | ||||
-rw-r--r-- | src/mm_player_priv.c | 11 |
4 files changed, 23 insertions, 11 deletions
diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 45b0148..ab934c1 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -1,6 +1,6 @@ Name: libmm-player Summary: Multimedia Framework Player Library -Version: 0.6.64 +Version: 0.6.65 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/include/mm_player_pd.h b/src/include/mm_player_pd.h index 9e54cb2..2841603 100644 --- a/src/include/mm_player_pd.h +++ b/src/include/mm_player_pd.h @@ -37,7 +37,7 @@ typedef struct { gchar *path_read_from; // path for download and playback gchar *location_to_save; // path for saving to local gint64 total_size; // size of file to download (bytes) - + GMutex pd_mutex; GstElement *playback_pipeline_src; // src element of playback pipeline GstElement *downloader_pipeline; GstElement *downloader_src; diff --git a/src/mm_player_pd.c b/src/mm_player_pd.c index 62c6ffe..8c9511b 100644 --- a/src/mm_player_pd.c +++ b/src/mm_player_pd.c @@ -277,6 +277,9 @@ gboolean _mmplayer_destroy_pd_downloader(MMHandleType handle) if (pd && pd->downloader_pipeline) _mmplayer_unrealize_pd_downloader(handle); + if (pd) + g_mutex_clear(&pd->pd_mutex); + /* release PD handle */ MMPLAYER_FREEIF(pd); @@ -304,6 +307,7 @@ gboolean _mmplayer_realize_pd_downloader(MMHandleType handle, gchar *src_uri, gc pd->location_to_save = g_strdup(dst_uri); pd->playback_pipeline_src = pushsrc; pd->total_size = 0LL; + g_mutex_init(&pd->pd_mutex); MMPLAYER_FLEAVE(); @@ -381,10 +385,13 @@ gboolean _mmplayer_start_pd_downloader(MMHandleType handle) SECURE_LOGD("src location = %s, save location = %s\n", pd->path_read_from, pd->location_to_save); + g_mutex_lock(&pd->pd_mutex); + /* Start to download */ sret = gst_element_set_state(pd->downloader_pipeline, GST_STATE_PLAYING); if (GST_STATE_CHANGE_FAILURE == sret) { LOGE("PD download pipeline failed to go to PLAYING state..."); + g_mutex_unlock(&pd->pd_mutex); return FALSE; } @@ -393,11 +400,14 @@ gboolean _mmplayer_start_pd_downloader(MMHandleType handle) sret = gst_element_get_state(pd->downloader_pipeline, &cur_state, &pending_state, PD_STATE_CHANGE_TIMEOUT); if (GST_STATE_CHANGE_FAILURE == sret) { LOGE("PD download pipeline failed to do get_state..."); + g_mutex_unlock(&pd->pd_mutex); return FALSE; } LOGD("get-state :: sret = %d\n", sret); + g_mutex_unlock(&pd->pd_mutex); + MMPLAYER_FLEAVE(); return TRUE; @@ -409,6 +419,7 @@ gboolean _mmplayer_unrealize_pd_downloader(MMHandleType handle) MMPLAYER_FENTER(); mm_player_pd_t * pd = NULL; + GstBus *bus = NULL; MMPLAYER_RETURN_VAL_IF_FAIL(handle, FALSE); @@ -416,6 +427,12 @@ gboolean _mmplayer_unrealize_pd_downloader(MMHandleType handle) MMPLAYER_RETURN_VAL_IF_FAIL(pd && pd->downloader_pipeline, FALSE); + g_mutex_lock(&pd->pd_mutex); + + bus = gst_pipeline_get_bus(GST_PIPELINE(pd->downloader_pipeline)); + gst_bus_remove_watch(bus); + gst_object_unref(bus); + gst_element_set_state(pd->downloader_pipeline, GST_STATE_NULL); gst_element_get_state(pd->downloader_pipeline, NULL, NULL, PD_STATE_CHANGE_TIMEOUT); @@ -426,6 +443,8 @@ gboolean _mmplayer_unrealize_pd_downloader(MMHandleType handle) MMPLAYER_FREEIF(pd->path_read_from); MMPLAYER_FREEIF(pd->location_to_save); + g_mutex_unlock(&pd->pd_mutex); + MMPLAYER_FLEAVE(); return TRUE; diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index c2e6732..4c06677 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -8700,12 +8700,7 @@ __mmplayer_destroy_streaming_ext(mm_player_t* player) { MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - if (player->pd_downloader) { - _mmplayer_unrealize_pd_downloader((MMHandleType)player); - MMPLAYER_FREEIF(player->pd_downloader); - } - - if (MMPLAYER_IS_HTTP_PD(player)) { + if (player->pd_downloader || MMPLAYER_IS_HTTP_PD(player)) { _mmplayer_destroy_pd_downloader((MMHandleType)player); MMPLAYER_FREEIF(player->pd_file_save_path); } @@ -9052,10 +9047,8 @@ __mmplayer_unrealize_streaming_ext(mm_player_t *player) MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); /* destroy can called at anytime */ - if (player->pd_downloader && MMPLAYER_IS_HTTP_PD(player)) { + if (player->pd_downloader && MMPLAYER_IS_HTTP_PD(player)) _mmplayer_unrealize_pd_downloader((MMHandleType)player); - MMPLAYER_FREEIF(player->pd_downloader); - } MMPLAYER_FLEAVE(); return MM_ERROR_NONE; |