if (pd && pd->downloader_pipeline)
_mmplayer_unrealize_pd_downloader(handle);
+ if (pd)
+ g_mutex_clear(&pd->pd_mutex);
+
/* release PD handle */
MMPLAYER_FREEIF(pd);
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();
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;
}
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;
MMPLAYER_FENTER();
mm_player_pd_t * pd = NULL;
+ GstBus *bus = NULL;
MMPLAYER_RETURN_VAL_IF_FAIL(handle, FALSE);
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);
MMPLAYER_FREEIF(pd->path_read_from);
MMPLAYER_FREEIF(pd->location_to_save);
+ g_mutex_unlock(&pd->pd_mutex);
+
MMPLAYER_FLEAVE();
return TRUE;
{
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);
}
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;