__mmplayer_remove_g_source_from_context(player->context.thread_default, player->bus_watcher);
MMPLAYER_BUS_WATCHER_LOCK(player);
end_time = g_get_monotonic_time () + 2 * G_TIME_SPAN_SECOND;
- while (player->bus_watcher > 0)
- MMPLAYER_BUS_WATCHER_WAIT_UNTIL(player, end_time);
+ while (player->bus_watcher > 0) {
+ if (!MMPLAYER_BUS_WATCHER_WAIT_UNTIL(player, end_time)) {
+ LOGW("MMPLAYER_BUS_WATCHER_WAIT_UNTIL() timeout has passed - bus_watcher (%d)",
+ player->bus_watcher);
+ break;
+ }
+ }
MMPLAYER_BUS_WATCHER_UNLOCK(player);
-
g_mutex_clear(&player->bus_watcher_mutex);
g_cond_clear(&player->bus_watcher_cond);
}
MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "no-more-pads", G_CALLBACK(__mmplayer_gst_audio_deinterleave_no_more_pads), (gpointer)player);
player->no_more_pad = FALSE;
} else {
- /* 4-2. create fakesink to extract interlevaed pcm */
+ /* 4-2. create fakesink to extract interleaved pcm */
LOGD("add audio fakesink for interleaved audio");
MMPLAYER_CREATE_ELEMENT(audiobin, extract_sink_id, "fakesink", "fakeaudiosink", *bucket, player);
if (!(player->audio_extract_opt & MM_PLAYER_AUDIO_EXTRACT_NO_SYNC_WITH_CLOCK))
GList *l = NULL;
MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL);
gboolean ret = TRUE;
+ gint64 end_time = 0;
/* check DRC, if it is, destroy the prev bo list to create again */
if (player->video_bo_size != size) {
}
}
+ if (player->ini.video_bo_timeout > 0)
+ end_time = g_get_monotonic_time() + player->ini.video_bo_timeout * G_TIME_SPAN_SECOND;
+
while (TRUE) {
/* get bo from list*/
for (l = g_list_first(player->video_bo_list); l; l = g_list_next(l)) {
return tbm_bo_ref(tmp->bo);
}
}
- if (!ret) {
- LOGE("failed to get bo in %d timeout", player->ini.video_bo_timeout);
- MMPLAYER_VIDEO_BO_UNLOCK(player);
- return NULL;
- }
if (player->ini.video_bo_timeout <= 0) {
MMPLAYER_VIDEO_BO_WAIT(player);
} else {
- gint64 timeout = g_get_monotonic_time() + player->ini.video_bo_timeout * G_TIME_SPAN_SECOND;
- ret = MMPLAYER_VIDEO_BO_WAIT_UNTIL(player, timeout);
+ ret = MMPLAYER_VIDEO_BO_WAIT_UNTIL(player, end_time);
+ if (!ret) {
+ LOGE("failed to get bo in %d timeout", player->ini.video_bo_timeout);
+ break;
+ }
}
- continue;
}
+
+ MMPLAYER_VIDEO_BO_UNLOCK(player);
+ return NULL;
}
static void
__mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_ALL);
if (mainbin) {
- mmplayer_gst_element_t *audiobin = player->pipeline->audiobin;
- mmplayer_gst_element_t *videobin = player->pipeline->videobin;
- mmplayer_gst_element_t *textbin = player->pipeline->textbin;
GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(mainbin[MMPLAYER_M_PIPE].gst));
gst_bus_set_sync_handler(bus, NULL, NULL, NULL);
gst_object_unref(bus);
if (mainbin[MMPLAYER_M_SRC_FAKESINK].gst)
gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_SRC_FAKESINK].gst));
- MMPLAYER_FREEIF(audiobin);
- MMPLAYER_FREEIF(videobin);
- MMPLAYER_FREEIF(textbin);
+ MMPLAYER_FREEIF(player->pipeline->audiobin);
+ MMPLAYER_FREEIF(player->pipeline->videobin);
+ MMPLAYER_FREEIF(player->pipeline->textbin);
MMPLAYER_FREEIF(mainbin);
}
player->interrupted_by_resource = TRUE;
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_INTERRUPT_STARTED, NULL);
+
/* get last play position */
if (_mmplayer_gst_get_position(player, &pos) == MM_ERROR_NONE) {
msg.union_type = MM_MSG_UNION_TIME;
ret = _mmplayer_initialize_video_capture(player);
if (ret != MM_ERROR_NONE) {
- LOGE("failed to initialize video capture");
- goto ERROR;
+ LOGW("video capture is not supported");
+ /* do not handle as error for headless profile */
}
/* initialize resource manager */
player->pipeline->mainbin,
MM_ERROR_PLAYER_NOT_INITIALIZED);
- LOGD("set the pipeline state to READY");
+ if (player->pipeline->videobin && player->pipeline->videobin[MMPLAYER_V_BIN].gst) {
+ LOGD("set the videobin state to READY");
+ ret = _mmplayer_gst_set_state(player, player->pipeline->videobin[MMPLAYER_V_BIN].gst,
+ GST_STATE_READY, TRUE, MMPLAYER_STATE_CHANGE_TIMEOUT(player));
+
+ }
- /* set state to READY */
+ if (player->pipeline->audiobin && player->pipeline->audiobin[MMPLAYER_A_BIN].gst) {
+ LOGD("set the audiobin state to READY");
+ ret = _mmplayer_gst_set_state(player, player->pipeline->audiobin[MMPLAYER_A_BIN].gst,
+ GST_STATE_READY, TRUE, MMPLAYER_STATE_CHANGE_TIMEOUT(player));
+
+ }
+
+ LOGD("set the pipeline state to READY");
ret = _mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
GST_STATE_READY, FALSE, MMPLAYER_STATE_CHANGE_TIMEOUT(player));
+
if (ret != MM_ERROR_NONE) {
LOGE("fail to change state to READY");
return MM_ERROR_PLAYER_INTERNAL;
MMPLAYER_FREEIF(caps_str);
} else if (g_str_has_prefix(mime, "video") && player->videodec_linked) {
- LOGD("already video linked");
- ret = FALSE;
+ if((MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) || (MMPLAYER_IS_DASH_STREAMING(player))) {
+ LOGD("video is already linked, allow the stream switch");
+ ret = TRUE;
+ } else {
+ LOGD("video is already linked");
+ ret = FALSE;
+ }
} else {
LOGD("found new stream");
}
if (MMPLAYER_USE_DECODEBIN(player))
return;
- if (!videobin || !g_str_has_prefix (GST_PAD_NAME (pad), "video"))
+ if (!videobin || !g_str_has_prefix(GST_PAD_NAME (pad), "video"))
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;
+ __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN);
+
+ 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), mainbin[MMPLAYER_M_V_CONCAT].gst)) {
+ LOGE("failed to remove video concat");
}
ret = _mmplayer_gst_set_state(player, videobin[MMPLAYER_V_BIN].gst, GST_STATE_NULL, FALSE, timeout);
return;
}
- 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), videobin[MMPLAYER_V_BIN].gst)) {
- LOGE("failed to remove videobin");
+ 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));
_mmplayer_set_reconfigure_state(player, TRUE);
MMPLAYER_CMD_UNLOCK(player);
- MMPLAYER_POST_MSG(player, MM_MESSAGE_GAPLESS_CONSTRUCTION, NULL);
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_FLUSH_BUFFER, NULL);
__mmplayer_deactivate_old_path(player);
MMPLAYER_FLEAVE();
player->gapless.update_segment[MM_PLAYER_TRACK_TYPE_VIDEO] = FALSE;
/* deactivate pipeline except sinkbins to set up the new pipeline of next uri*/
- MMPLAYER_POST_MSG(player, MM_MESSAGE_GAPLESS_CONSTRUCTION, NULL); /* post message for gapless */
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_FLUSH_BUFFER, NULL); /* post message for gapless */
__mmplayer_deactivate_old_path(player);
MMPLAYER_FLEAVE();
#endif
player->pipeline->mainbin[MMPLAYER_M_DEMUX].id = MMPLAYER_M_DEMUX;
player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst = element;
+ } else if (g_strrstr(klass, "Parser") && (g_strrstr(klass, "Video"))) {
+ player->pipeline->mainbin[MMPLAYER_M_V_PARSE].id = MMPLAYER_M_V_PARSE;
+ player->pipeline->mainbin[MMPLAYER_M_V_PARSE].gst = element;
}
if (g_strrstr(factory_name, "asfdemux") || g_strrstr(factory_name, "qtdemux") || g_strrstr(factory_name, "avidemux")) {
}
} else if (g_strrstr(factory_name, player->ini.videocodec_element_hw)) {
player->pipeline->mainbin[MMPLAYER_M_DEC1].gst = element;
+ } else if (g_strrstr(factory_name, "omxdec_h264")) {
+ GstElement *video_parse = player->pipeline->mainbin[MMPLAYER_M_V_PARSE].gst;
+ if (video_parse && (g_object_class_find_property(G_OBJECT_GET_CLASS(video_parse), "config-interval"))) {
+ g_object_set(G_OBJECT(video_parse), "config-interval", -1, NULL);
+ LOGD("Send SPS and PPS Insertion every IDR frame");
+ }
}
if ((player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst) &&
for (; sig_list; sig_list = sig_list->next) {
item = sig_list->data;
- if (item && item->obj && GST_IS_ELEMENT(item->obj)) {
+ if (item && item->obj) {
if (g_signal_handler_is_connected(item->obj, item->sig))
g_signal_handler_disconnect(item->obj, item->sig);
}
if (streams) {
LOGD("send select stream event");
- gst_element_send_event(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
+ gst_element_send_event(player->pipeline->mainbin[MMPLAYER_M_AUTOPLUG].gst,
gst_event_new_select_streams(streams));
g_list_free(streams);
}
}
p = gst_caps_get_structure(caps_a, 0);
-
- mm_attrs_get_int_by_name(attrs, "content_audio_samplerate", &samplerate);
-
gst_structure_get_int(p, "rate", &samplerate);
gst_structure_get_int(p, "channels", &channels);