[0.6.170] update buffer size after buffering done 78/198778/2 accepted/tizen/unified/20190131.061534 submit/tizen/20190130.081127
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 29 Jan 2019 10:17:05 +0000 (19:17 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 29 Jan 2019 10:20:36 +0000 (19:20 +0900)
- buffer size should be updated after buffering done
  for next buffering.
  if not, the initial buffering msg information will be
  based on the previous buffering criteria.

Change-Id: I594f731fc52f5b334e8d929acd68352493be806c

packaging/libmm-player.spec
src/mm_player_gst.c
src/mm_player_streaming.c

index d2548c4..be484f5 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.169
+Version:    0.6.170
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 6a45e9d..1a62f14 100644 (file)
@@ -825,7 +825,7 @@ __mmplayer_gst_extract_tag_from_msg(mm_player_t *player, GstMessage *msg)
                                gst_date_time_unref(datetime);\
                        } \
                } \
-       } while(0)
+       } while (0)
 
 #define MMPLAYER_UPDATE_TAG_UINT64(gsttag, attribute, playertag) \
        do { \
@@ -1519,6 +1519,7 @@ __mmplayer_gst_handle_buffering_message(mm_player_t *player, GstMessage *msg)
 
                if (buffer_percent == MAX_BUFFER_PERCENT) {
                        LOGD("Ignored all the previous buffering msg!(got %d%%)", buffer_percent);
+                       __mmplayer_update_buffer_setting(player, NULL); /* update buffering size for next buffering */
                        player->streamer->buffering_state = MM_PLAYER_BUFFERING_DEFAULT;
                }
                MMPLAYER_CMD_UNLOCK(player);
@@ -2531,7 +2532,7 @@ __mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data)
        caps = gst_pad_query_caps(pad, NULL);
        MMPLAYER_CHECK_NULL(caps);
 
-       str = gst_caps_get_structure (caps, 0);
+       str = gst_caps_get_structure(caps, 0);
        name = gst_structure_get_string(str, "media");
        if (!name) {
                LOGE("cannot get mimetype from structure.");
index 6c88132..cf73ee1 100644 (file)
@@ -412,6 +412,7 @@ void __mm_player_streaming_sync_property(mm_player_streaming_t *streamer, GstEle
        buffer_handle = &(streamer->buffer_handle[BUFFER_TYPE_DEMUXED]);
        low_watermark = streaming_get_min_watermark(buffer_handle->buffer_high_watermark, buffer_handle->buffering_time);
 
+       LOGD("sync : %1.3f ~ %1.3f", low_watermark, buffer_handle->buffer_high_watermark);
        g_object_set(G_OBJECT(decodebin),
                                "max-size-bytes", buffer_handle->buffering_bytes,
                                "max-size-time", (guint64)(buffer_handle->buffering_time * GST_MSECOND),
@@ -788,6 +789,8 @@ static void streaming_update_buffering_status(mm_player_streaming_t *streamer, G
 
        MMPLAYER_RETURN_IF_FAIL(streamer);
        MMPLAYER_RETURN_IF_FAIL(buffering_msg);
+       MMPLAYER_RETURN_IF_FAIL(GST_IS_MESSAGE(buffering_msg));
+       MMPLAYER_RETURN_IF_FAIL((GST_MESSAGE_TYPE(buffering_msg) == GST_MESSAGE_BUFFERING));
 
        /* update when buffering has started. */
        if (!(streamer->buffering_state & MM_PLAYER_BUFFERING_IN_PROGRESS)) {
@@ -814,6 +817,7 @@ static void streaming_update_buffering_status(mm_player_streaming_t *streamer, G
        if (streamer->buffering_percent == MAX_BUFFER_PERCENT) {
                streamer->buffering_state = MM_PLAYER_BUFFERING_DEFAULT;
                streamer->buffering_req.is_pre_buffering = FALSE;
+               streamer->need_update = TRUE;
        } else if (streamer->buffering_state & MM_PLAYER_BUFFERING_COMPLETE) {
                streamer->buffering_state = MM_PLAYER_BUFFERING_COMPLETE; /* have to keep state to ignore remained msg till get 100% msg */
                streamer->buffering_req.is_pre_buffering = FALSE;
@@ -826,19 +830,17 @@ void __mm_player_streaming_buffering(mm_player_streaming_t *streamer, GstMessage
        guint64 content_size, gint64 position, gint64 duration)
 {
        MMPLAYER_FENTER();
-
        MMPLAYER_RETURN_IF_FAIL(streamer);
-       MMPLAYER_RETURN_IF_FAIL(buffering_msg);
-       MMPLAYER_RETURN_IF_FAIL(GST_IS_MESSAGE(buffering_msg));
-       MMPLAYER_RETURN_IF_FAIL((GST_MESSAGE_TYPE(buffering_msg) == GST_MESSAGE_BUFFERING));
 
-       if (position > (gint64)(streamer->buffering_req.prebuffer_time * GST_MSECOND))
-               streamer->buffering_req.is_pre_buffering = FALSE;
+       if (buffering_msg) {
+               if (position > (gint64)(streamer->buffering_req.prebuffer_time * GST_MSECOND))
+                       streamer->buffering_req.is_pre_buffering = FALSE;
 
-       streaming_update_buffering_status(streamer, buffering_msg, position);
+               streaming_update_buffering_status(streamer, buffering_msg, position);
 
-       if (!streamer->need_update)
-               return;
+               if (!streamer->need_update)
+                       return;
+       }
 
        streamer->need_update = FALSE;
        streaming_update_buffer_setting(streamer, buffering_msg, content_size, position, duration);