From 2d0748167dd3d9853749a46a9e7ef0385b0bb4f4 Mon Sep 17 00:00:00 2001 From: Hyunil Park Date: Mon, 6 Jul 2015 15:02:19 +0900 Subject: [PATCH] add buffering scheme for hls Change-Id: Iadad9cf1837b88503e0481e9ac0281e35d9dd73e Signed-off-by: Hyunil Park --- src/include/mm_player_streaming.h | 15 ++++++++------- src/mm_player_priv.c | 30 +++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/include/mm_player_streaming.h b/src/include/mm_player_streaming.h index a2bf57d..ab2d40f 100755 --- a/src/include/mm_player_streaming.h +++ b/src/include/mm_player_streaming.h @@ -37,15 +37,16 @@ #define MIN_BUFFERING_TIME 3.0 #define MAX_BUFFERING_TIME 10.0 -#define MAX_DECODEBIN_BUFFER_BYTES (32 * 1024 * 1024) // byte -#define MAX_DECODEBIN_BUFFER_TIME 15 // sec +#define MAX_DECODEBIN_BUFFER_BYTES (32 * 1024 * 1024) /* byte */ +#define MAX_DECODEBIN_BUFFER_TIME 15 /* sec */ -#define DEFAULT_BUFFER_SIZE_BYTES 4194304 // 4 MBytes -#define DEFAULT_PLAYING_TIME 10 // 10 sec +#define DEFAULT_BUFFER_SIZE_BYTES 4194304 /* 4 MBytes */ +#define DEFAULT_PLAYING_TIME 10 /* 10 sec */ +#define DEFAULT_LIVE_PLAYING_TIME 3 /* 3 sec */ -#define DEFAULT_BUFFERING_TIME 3.0 // 3sec -#define DEFAULT_BUFFER_LOW_PERCENT 1.0 // 1% -#define DEFAULT_BUFFER_HIGH_PERCENT 99.0 // 15% +#define DEFAULT_BUFFERING_TIME 3.0 /* 3sec */ +#define DEFAULT_BUFFER_LOW_PERCENT 1.0 /* 1% */ +#define DEFAULT_BUFFER_HIGH_PERCENT 99.0 /* 15% */ #define DEFAULT_FILE_BUFFER_PATH "/opt/media" diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index 9246d61..3c39527 100755 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -13448,7 +13448,7 @@ __mmplayer_gst_element_added (GstElement *bin, GstElement *element, gpointer dat player->parsers = g_list_append (player->parsers, selected); } - if (g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse")) + if ((g_strrstr(klass, "Demux") || g_strrstr(klass, "Parse")) && !(g_strrstr(klass, "Adaptive"))) { /* FIXIT : first value will be overwritten if there's more * than 1 demuxer/parser @@ -13536,14 +13536,22 @@ __mmplayer_gst_element_added (GstElement *bin, GstElement *element, gpointer dat player->pipeline->mainbin[MMPLAYER_M_DEC1].gst = element; } - if (g_strrstr(GST_ELEMENT_NAME(element), "multiqueue")) + if ((player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst) && + (g_strrstr(GST_ELEMENT_NAME(element), "multiqueue"))) { debug_log ("plugged element is multiqueue. take it\n"); + player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].id = MMPLAYER_M_DEMUXED_S_BUFFER; player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst = element; - if (MMPLAYER_IS_HTTP_STREAMING(player)) + if ((MMPLAYER_IS_HTTP_STREAMING(player)) || + (MMPLAYER_IS_HTTP_LIVE_STREAMING(player))) { + + if ((MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) && + (player->streamer->buffering_req.initial_second == 0)) + player->streamer->buffering_req.initial_second = DEFAULT_LIVE_PLAYING_TIME; + __mm_player_streaming_set_multiqueue(player->streamer, element, TRUE, @@ -15745,6 +15753,22 @@ __gst_send_event_to_sink( mm_player_t* player, GstEvent* event ) { debug_log("sending event[%s] to sink element [%s] success!\n", GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(sink) ); + + /* rtsp case, asyn_done is not called after seek during pause state */ + if (MMPLAYER_IS_RTSP_STREAMING(player)) + { + if (strstr(GST_EVENT_TYPE_NAME(event), "seek")) + { + if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED) + { + debug_log("RTSP seek completed, after pause state..\n"); + player->doing_seek = FALSE; + MMPLAYER_POST_MSG ( player, MM_MESSAGE_SEEK_COMPLETED, NULL ); + } + + } + } + #ifdef TEST_ES if( MMPLAYER_IS_ES_BUFF_SRC(player)) { -- 2.34.1