}
has_video_attrs = TRUE;
- } else
+ } else {
LOGD("no negitiated caps from videosink");
- gst_object_unref(pad);
+ }
+ gst_object_unref(GST_OBJECT(pad));
pad = NULL;
- } else
+ } else {
LOGD("no videosink sink pad");
+ }
}
}
player->audio_stream_cb = NULL;
player->audio_stream_cb_user_param = NULL;
+ gst_object_unref(GST_OBJECT(pad));
+
}
}
if ((player->audio_stream_render_cb_ex) && (!player->audio_stream_sink_sync))
}
}
+ gst_object_unref(GST_OBJECT(sinkpad));
+
selector = player->pipeline->mainbin[elemId].gst;
if (selector == NULL) {
selector = gst_element_factory_make("input-selector", NULL);
gst_pad_remove_probe(srcpad, player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id);
player->selector[MM_PLAYER_TRACK_TYPE_VIDEO].block_id = 0;
}
+
+ gst_object_unref(GST_OBJECT(srcpad));
+ srcpad = NULL;
}
if (audio_selector) {
}
}
+ gst_object_unref(GST_OBJECT(srcpad));
+ srcpad = NULL;
+
LOGD("Total audio tracks = %d \n", player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].total_track_num);
attrs = MMPLAYER_GET_ATTRS(player);
MMPLAYER_FLEAVE();
ERROR:
- if (srcpad) {
- gst_object_unref(GST_OBJECT(srcpad));
- srcpad = NULL;
- }
-
if (player->gapless.reconfigure) {
player->gapless.reconfigure = FALSE;
MMPLAYER_PLAYBACK_UNLOCK(player);
} // else error
} // else error
- if (mainbin[MMPLAYER_M_S_BUFFER].gst)
- __mmplayer_try_to_plug_decodebin(player, gst_element_get_static_pad(mainbin[MMPLAYER_M_S_BUFFER].gst, "src"), player->s_stream_caps);
+ if (mainbin[MMPLAYER_M_S_BUFFER].gst) {
+ srcpad = gst_element_get_static_pad(mainbin[MMPLAYER_M_S_BUFFER].gst, "src");
+ __mmplayer_try_to_plug_decodebin(player, srcpad, player->s_stream_caps);
+ gst_object_unref(GST_OBJECT(srcpad));
+ srcpad = NULL;
+ }
}
/* Note : check whether subtitle atrribute uri is set. If uri is set, then try to play subtitle file */
}
gst_object_unref(GST_OBJECT(sinkpad));
+ gst_object_unref(GST_OBJECT(qsrcpad));
mainbin[MMPLAYER_M_AUTOPLUG].id = MMPLAYER_M_AUTOPLUG;
mainbin[MMPLAYER_M_AUTOPLUG].gst = decodebin;
if (sinkpad)
gst_object_unref(GST_OBJECT(sinkpad));
+ if (qsrcpad)
+ gst_object_unref(GST_OBJECT(qsrcpad));
+
if (queue2) {
/* NOTE : Trying to dispose element queue0, but it is in READY instead of the NULL state.
* You need to explicitly set elements to the NULL state before
NULL, NULL, NULL);
{
LOGE("failed to set block pad(video)");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
LOGW("pad is blocked(video)");
} else {
if (!gst_element_remove_pad(player->pipeline->videobin[MMPLAYER_V_BIN].gst,
GST_PAD_CAST(GST_GHOST_PAD(player->ghost_pad_for_videobin)))) {
LOGE("failed to remove previous ghost_pad for videobin");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
/* change state of videobin to NULL */
ret = gst_element_set_state(player->pipeline->videobin[MMPLAYER_V_BIN].gst, GST_STATE_NULL);
if (ret != GST_STATE_CHANGE_SUCCESS) {
LOGE("failed to change state of videobin to NULL");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
/* unlink between decoder and videobin and remove previous videosink from videobin */
gst_element_unlink(GST_ELEMENT(player->pipeline->mainbin[dec_index].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst));
if (!gst_bin_remove(GST_BIN(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst))) {
LOGE("failed to remove former videosink from videobin");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
__mmplayer_del_sink(player, player->pipeline->videobin[MMPLAYER_V_SINK].gst);
player->pipeline->videobin[MMPLAYER_V_SINK].gst = gst_element_factory_make(videosink_element, "videosink");
if (!player->pipeline->videobin[MMPLAYER_V_SINK].gst) {
LOGE("failed to create videosink element\n");
- MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
gst_bin_add(GST_BIN(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst));
__mmplayer_add_sink(player, player->pipeline->videobin[MMPLAYER_V_SINK].gst);
break;
default:
LOGE("invalid type(%d) for changing display surface", surface_type);
- MMPLAYER_FLEAVE();
- return MM_ERROR_INVALID_ARGUMENT;
+ goto ERROR;
}
if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit");
- MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
} else {
LOGE("player->attrs is null, failed to save attributes");
- MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
/* update video param */
if (MM_ERROR_NONE != _mmplayer_update_video_param(player, "update_all_param")) {
LOGE("failed to update video param");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
/* change state of videobin to READY */
ret = gst_element_set_state(player->pipeline->videobin[MMPLAYER_V_BIN].gst, GST_STATE_READY);
if (ret != GST_STATE_CHANGE_SUCCESS) {
LOGE("failed to change state of videobin to READY");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
/* change ghostpad */
sink_pad_videosink = gst_element_get_static_pad(GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "sink");
if (!sink_pad_videosink) {
LOGE("failed to get sink pad from videosink element");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
player->ghost_pad_for_videobin = gst_ghost_pad_new("sink", sink_pad_videosink);
if (!gst_pad_set_active(player->ghost_pad_for_videobin, TRUE)) {
LOGE("failed to set active to ghost_pad");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
if (FALSE == gst_element_add_pad(player->pipeline->videobin[MMPLAYER_V_BIN].gst, player->ghost_pad_for_videobin)) {
LOGE("failed to change ghostpad for videobin");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
gst_object_unref(sink_pad_videosink);
+ sink_pad_videosink = NULL;
/* link decoder with videobin */
sink_pad_videobin = gst_element_get_static_pad(GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst), "sink");
if (!sink_pad_videobin) {
LOGE("failed to get sink pad from videobin");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
if (GST_PAD_LINK_OK != gst_pad_link(src_pad_dec, sink_pad_videobin)) {
LOGE("failed to link");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
gst_object_unref(sink_pad_videobin);
+ sink_pad_videobin = NULL;
/* clock setting for a new videosink plugin */
/* NOTE : Below operation is needed, because a new videosink plugin doesn't have clock for basesink,
GST_TIME_FORMAT, GST_TIME_ARGS(now), GST_TIME_ARGS(base_time));
} else {
LOGE("failed to get clock of videosink after setting clock");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
- } else
+ } else {
LOGW("failed to get clock, maybe it is the time before first playing");
+ }
if (!player->doing_seek && previous_state == MM_PLAYER_STATE_PLAYING) {
/* change state of videobin to PAUSED */
LOGW("change state of videobin to PLAYING, ret(%d)", ret);
} else {
LOGE("failed to change state of videobin to PLAYING");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
/* release blocked and unref src pad of video decoder */
LOGW("change state of videobin to PAUSED, ret(%d)", ret);
} else {
LOGE("failed to change state of videobin to PLAYING");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
/* already skipped pad block */
LOGD("do get/set position for new videosink plugin");
if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position)) {
LOGE("failed to get position");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
#ifdef SINKCHANGE_WITH_ACCURATE_SEEK
/* accurate seek */
if (__gst_set_position(player, MM_PLAYER_POS_FORMAT_TIME, position, TRUE)) {
LOGE("failed to set position");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
#else
/* key unit seek */
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
if (!ret) {
LOGE("failed to set position");
- return MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
}
#endif
}
MMPLAYER_FLEAVE();
return MM_ERROR_NONE;
+
+ERROR:
+ if (src_pad_dec)
+ gst_object_unref(src_pad_dec);
+ if (sink_pad_videosink)
+ gst_object_unref(sink_pad_videosink);
+ if (sink_pad_videobin)
+ gst_object_unref(sink_pad_videobin);
+
+ MMPLAYER_FLEAVE();
+ return MM_ERROR_PLAYER_INTERNAL;
}
if (dump_s->dump_pad) {
if (dump_s->probe_handle_id)
gst_pad_remove_probe(dump_s->dump_pad, dump_s->probe_handle_id);
+
+ gst_object_unref(GST_OBJECT(dump_s->dump_pad));
}
if (dump_s->dump_element_file) {
fclose(dump_s->dump_element_file);