- after calling gst_bin_remove, the element is removed
and the reference is cleard too.
Change-Id: Iffb267d092160c0b467f32a9aafbc72837ddb2d3
Name: libmm-player
Summary: Multimedia Framework Player Library
Name: libmm-player
Summary: Multimedia Framework Player Library
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
- mainbin[elem_id].id = elem_id;
- mainbin[elem_id].gst = decodebin;
-
/* raw pad handling signal */
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
G_CALLBACK(_mmplayer_gst_decode_pad_added), (gpointer)player);
/* raw pad handling signal */
_mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added",
G_CALLBACK(_mmplayer_gst_decode_pad_added), (gpointer)player);
gst_object_unref(GST_OBJECT(sinkpad));
gst_element_sync_state_with_parent(decodebin);
gst_object_unref(GST_OBJECT(sinkpad));
gst_element_sync_state_with_parent(decodebin);
+
+ mainbin[elem_id].id = elem_id;
+ mainbin[elem_id].gst = decodebin;
+
MMPLAYER_FLEAVE();
return TRUE;
MMPLAYER_FLEAVE();
return TRUE;
if (sinkpad)
gst_object_unref(GST_OBJECT(sinkpad));
if (sinkpad)
gst_object_unref(GST_OBJECT(sinkpad));
- if (mainbin[elem_id].gst) {
- gst_element_set_state(mainbin[elem_id].gst, GST_STATE_NULL);
- gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[elem_id].gst);
- gst_object_unref(mainbin[elem_id].gst);
- mainbin[elem_id].gst = NULL;
+ if (decodebin) {
+ gst_element_set_state(decodebin, GST_STATE_NULL);
+ if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin))
+ gst_object_unref(decodebin);
ERROR:
if (mainbin[src_id].gst) {
gst_element_set_state(mainbin[src_id].gst, GST_STATE_NULL);
ERROR:
if (mainbin[src_id].gst) {
gst_element_set_state(mainbin[src_id].gst, GST_STATE_NULL);
- gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[src_id].gst);
- gst_object_unref(mainbin[src_id].gst);
+ if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[src_id].gst))
+ gst_object_unref(mainbin[src_id].gst);
mainbin[src_id].gst = NULL;
}
if (mainbin[queue_id].gst) {
gst_element_set_state(mainbin[queue_id].gst, GST_STATE_NULL);
mainbin[src_id].gst = NULL;
}
if (mainbin[queue_id].gst) {
gst_element_set_state(mainbin[queue_id].gst, GST_STATE_NULL);
- gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[queue_id].gst);
- gst_object_unref(mainbin[queue_id].gst);
+ if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[queue_id].gst))
+ gst_object_unref(mainbin[queue_id].gst);
mainbin[queue_id].gst = NULL;
}
mainbin[queue_id].gst = NULL;
}
/* And, it still has a parent "player".
* You need to let the parent manage the object instead of unreffing the object directly.
*/
/* And, it still has a parent "player".
* You need to let the parent manage the object instead of unreffing the object directly.
*/
- gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue2);
- gst_object_unref(queue2);
+ if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue2)) {
+ LOGE("failed to remove queue2");
+ gst_object_unref(queue2);
+ }
* You need to let the parent manage the object instead of unreffing the object directly.
*/
* You need to let the parent manage the object instead of unreffing the object directly.
*/
- gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin);
- gst_object_unref(decodebin);
+ if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin)) {
+ LOGE("failed to remove decodebin");
+ gst_object_unref(decodebin);
+ }
g_ptr_array_set_size(selector->streams, 0);
gst_element_set_state(player->pipeline->mainbin[selectorId].gst, GST_STATE_NULL);
g_ptr_array_set_size(selector->streams, 0);
gst_element_set_state(player->pipeline->mainbin[selectorId].gst, GST_STATE_NULL);
- gst_bin_remove(GST_BIN_CAST(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), player->pipeline->mainbin[selectorId].gst);
+ if (!gst_bin_remove(GST_BIN_CAST(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst),
+ player->pipeline->mainbin[selectorId].gst)) {
+ LOGE("failed to remove selector");
+ gst_object_unref(player->pipeline->mainbin[selectorId].gst);
+ }
player->pipeline->mainbin[selectorId].gst = NULL;
selector = NULL;
player->pipeline->mainbin[selectorId].gst = NULL;
selector = NULL;
mmplayer_t *player = (mmplayer_t *)data;
mmplayer_gst_element_t *mainbin = player->pipeline->mainbin;
mmplayer_gst_element_t *videobin = player->pipeline->videobin;
mmplayer_t *player = (mmplayer_t *)data;
mmplayer_gst_element_t *mainbin = player->pipeline->mainbin;
mmplayer_gst_element_t *videobin = player->pipeline->videobin;
- gint timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && mainbin);
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && mainbin);
if (!gst_bin_remove(GST_BIN_CAST(mainbin[MMPLAYER_M_PIPE].gst), videobin[MMPLAYER_V_BIN].gst)) {
LOGE("failed to remove videobin");
if (!gst_bin_remove(GST_BIN_CAST(mainbin[MMPLAYER_M_PIPE].gst), videobin[MMPLAYER_V_BIN].gst)) {
LOGE("failed to remove videobin");
+ gst_object_unref(GST_OBJECT(videobin[MMPLAYER_V_BIN].gst));
}
if (!gst_bin_remove(GST_BIN_CAST(mainbin[MMPLAYER_M_PIPE].gst), mainbin[MMPLAYER_M_V_CONCAT].gst)) {
LOGE("failed to remove video concat");
}
if (!gst_bin_remove(GST_BIN_CAST(mainbin[MMPLAYER_M_PIPE].gst), mainbin[MMPLAYER_M_V_CONCAT].gst)) {
LOGE("failed to remove video concat");
+ gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_V_CONCAT].gst));
- ret = _mmplayer_gst_set_state(player, videobin[MMPLAYER_V_BIN].gst, GST_STATE_NULL, FALSE, timeout);
- if (ret != MM_ERROR_NONE) {
- LOGE("fail to change state to NULL");
- return;
- }
-
- ret = _mmplayer_gst_set_state(player, mainbin[MMPLAYER_M_V_CONCAT].gst, GST_STATE_NULL, FALSE, timeout);
- if (ret != MM_ERROR_NONE) {
- LOGE("fail to change state to NULL");
- return;
- }
-
- gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_V_CONCAT].gst));
mainbin[MMPLAYER_M_V_CONCAT].gst = NULL;
mainbin[MMPLAYER_M_V_CONCAT].id = 0;
mainbin[MMPLAYER_M_V_CONCAT].gst = NULL;
mainbin[MMPLAYER_M_V_CONCAT].id = 0;
-
- gst_object_unref(GST_OBJECT(videobin[MMPLAYER_V_BIN].gst));
MMPLAYER_FREEIF(player->pipeline->videobin);
ret = __mmplayer_release_hw_resource(player, MMPLAYER_RESOURCE_TYPE_VIDEO_OVERLAY);
MMPLAYER_FREEIF(player->pipeline->videobin);
ret = __mmplayer_release_hw_resource(player, MMPLAYER_RESOURCE_TYPE_VIDEO_OVERLAY);