MMPLAYER_FENTER();
- MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && player->v_stream_caps, FALSE);
MMPLAYER_RETURN_VAL_IF_FAIL(fmt, FALSE);
- if (player->v_stream_caps) {
- str = gst_caps_get_structure(player->v_stream_caps, 0);
- if (!gst_structure_get_int(str, "width", &cur_width))
- LOGD("missing 'width' field in video caps");
-
- if (!gst_structure_get_int(str, "height", &cur_height))
- LOGD("missing 'height' field in video caps");
-
- media_format_get_video_info(fmt, &mimetype, &width, &height, NULL, NULL);
- if ((cur_width != width) || (cur_height != height)) {
- LOGW("resolution is changed %dx%d -> %dx%d",
- cur_width, cur_height, width, height);
- _mmplayer_set_video_info(hplayer, fmt);
- ret = TRUE;
- }
+ if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED &&
+ MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING) {
+ LOGW("skip update video info, state: %s", MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)));
+ return FALSE;
+ }
+
+ str = gst_caps_get_structure(player->v_stream_caps, 0);
+ if (!str) {
+ LOGE("failed to get caps info");
+ return FALSE;
+ }
+
+ if (!gst_structure_get_int(str, "width", &cur_width))
+ LOGD("missing 'width' field in video caps");
+
+ if (!gst_structure_get_int(str, "height", &cur_height))
+ LOGD("missing 'height' field in video caps");
+
+ media_format_get_video_info(fmt, &mimetype, &width, &height, NULL, NULL);
+ if ((cur_width != width) || (cur_height != height)) {
+ LOGW("resolution is changed %dx%d -> %dx%d",
+ cur_width, cur_height, width, height);
+ _mmplayer_set_video_info(hplayer, fmt);
+ ret = TRUE;
}
MMPLAYER_FLEAVE();
gst_buffer_unmap(_buffer, &buff_info);
}
+ /* wait till the pipeline is ready to get data, if not some data is missed */
+ while ((GST_STATE(element) < GST_STATE_PAUSED) && (wait_cnt < PLAYER_DATA_PUSH_WAIT_COUNT)) {
+ LOGW("wait to update source state : %d, %d", player->state, GST_STATE(element));
+ usleep(PLAYER_STATE_CHECK_INTERVAL);
+ wait_cnt++;
+ }
+
+ if (wait_cnt == PLAYER_DATA_PUSH_WAIT_COUNT) {
+ LOGE("source is not ready %d", GST_STATE(element));
+ ret = MM_ERROR_PLAYER_INTERNAL;
+ goto ERROR;
+ }
+
if (streamtype == MM_PLAYER_STREAM_TYPE_VIDEO) {
/* get format to check video format */
media_packet_get_format(packet, &fmt);
}
GST_BUFFER_PTS(_buffer) = (GstClockTime)pts;
- while ((GST_STATE(element) < GST_STATE_PAUSED) && (wait_cnt < PLAYER_DATA_PUSH_WAIT_COUNT)) {
- LOGW("wait to update source state : %d, %d", player->state, GST_STATE(element));
- usleep(PLAYER_STATE_CHECK_INTERVAL);
- wait_cnt++;
- }
-
- if (wait_cnt == PLAYER_DATA_PUSH_WAIT_COUNT) {
- LOGE("source is not ready %d", GST_STATE(element));
- ret = MM_ERROR_PLAYER_INTERNAL;
- goto ERROR;
- }
-
if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING) {
/* the pushed pts should be lager than current position if it is not in playing state. */
LOGD("type:%s, curr pos: %"G_GINT64_FORMAT", pushed pts:%"G_GINT64_FORMAT", size:%"G_GUINT64_FORMAT,