X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=plugins%2Felements%2Fgstmultiqueue.c;h=becbd8d9b801664580a2d427cf1772811095d826;hb=refs%2Fchanges%2F76%2F222676%2F2;hp=ea489013cceba4f4404c5e78d5935669969b7779;hpb=129493687793cbc109d6211bb0e465218e383e9d;p=platform%2Fupstream%2Fgstreamer.git diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index ea48901..becbd8d 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -244,7 +244,11 @@ enum * additional extra size. */ #define DEFAULT_EXTRA_SIZE_BYTES 10 * 1024 * 1024 /* 10 MB */ #define DEFAULT_EXTRA_SIZE_BUFFERS 5 +#ifdef TIZEN_FEATURE_MQ_MODIFICATION_EXTRA_SIZE_TIME +#define DEFAULT_EXTRA_SIZE_TIME 10 * GST_SECOND +#else #define DEFAULT_EXTRA_SIZE_TIME 3 * GST_SECOND +#endif #define DEFAULT_USE_BUFFERING FALSE #define DEFAULT_LOW_WATERMARK 0.01 @@ -264,6 +268,9 @@ enum PROP_MAX_SIZE_BYTES, PROP_MAX_SIZE_BUFFERS, PROP_MAX_SIZE_TIME, +#ifdef TIZEN_FEATURE_MQ_MODIFICATION + PROP_CURR_SIZE_BYTES, +#endif PROP_USE_BUFFERING, PROP_LOW_PERCENT, PROP_HIGH_PERCENT, @@ -513,7 +520,13 @@ gst_multi_queue_class_init (GstMultiQueueClass * klass) "Max. amount of data in the queue (in ns, 0=disable)", 0, G_MAXUINT64, DEFAULT_MAX_SIZE_TIME, G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS)); - +#ifdef TIZEN_FEATURE_MQ_MODIFICATION + g_object_class_install_property (gobject_class, PROP_CURR_SIZE_BYTES, + g_param_spec_uint ("curr-size-bytes", "Current buffered size (kB)", + "buffered amount of data in the queue (bytes)", 0, G_MAXUINT, + 0, G_PARAM_READABLE | GST_PARAM_MUTABLE_PLAYING | + G_PARAM_STATIC_STRINGS)); +#endif g_object_class_install_property (gobject_class, PROP_EXTRA_SIZE_BYTES, g_param_spec_uint ("extra-size-bytes", "Extra Size (kB)", "Amount of data the queues can grow if one of them is empty (bytes, 0=disable)" @@ -818,6 +831,33 @@ gst_multi_queue_set_property (GObject * object, guint prop_id, } } +#ifdef TIZEN_FEATURE_MQ_MODIFICATION +static guint +get_current_size_bytes (GstMultiQueue * mq) +{ + GList *tmp; + guint current_size_bytes = 0; + + for (tmp = mq->queues; tmp; tmp = g_list_next (tmp)) { + GstSingleQueue *sq = (GstSingleQueue *) tmp->data; + GstDataQueueSize size; + + gst_data_queue_get_level (sq->queue, &size); + + current_size_bytes += size.bytes; + + GST_DEBUG_OBJECT (mq, + "queue %d: bytes %u/%u, time %" G_GUINT64_FORMAT "/%" + G_GUINT64_FORMAT, sq->id, size.bytes, sq->max_size.bytes, + sq->cur_time, sq->max_size.time); + } + + GST_INFO_OBJECT (mq, "current_size_bytes : %u", current_size_bytes); + + return current_size_bytes; +} +#endif + static void gst_multi_queue_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) @@ -845,6 +885,11 @@ gst_multi_queue_get_property (GObject * object, guint prop_id, case PROP_MAX_SIZE_TIME: g_value_set_uint64 (value, mq->max_size.time); break; +#ifdef TIZEN_FEATURE_MQ_MODIFICATION + case PROP_CURR_SIZE_BYTES: + g_value_set_uint (value, get_current_size_bytes(mq)); + break; +#endif case PROP_USE_BUFFERING: g_value_set_boolean (value, mq->use_buffering); break; @@ -1017,6 +1062,16 @@ gst_multi_queue_change_state (GstElement * element, GstStateChange transition) break; } +#ifdef TIZEN_FEATURE_MQ_MODIFICATION + /* to stop buffering during playing state */ + case GST_STATE_CHANGE_PAUSED_TO_PLAYING:{ + GST_MULTI_QUEUE_MUTEX_LOCK (mqueue); + mqueue->buffering = FALSE; + GST_MULTI_QUEUE_MUTEX_UNLOCK (mqueue); + gst_multi_queue_post_buffering (mqueue); + break; + } +#endif case GST_STATE_CHANGE_PAUSED_TO_READY:{ GList *tmp; @@ -2281,6 +2336,18 @@ gst_multi_queue_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) gst_single_queue_flush (mq, sq, FALSE, FALSE); gst_single_queue_start (mq, sq); +#ifdef TIZEN_FEATURE_MQ_MODIFICATION + /* need to reset the buffering data after seeking */ + GList *tmp; + tmp = mq->queues; + while (tmp) { + GstSingleQueue *q = (GstSingleQueue *) tmp->data; + if (q->flushing) + goto done; + tmp = g_list_next (tmp); + } + recheck_buffering_status (mq); +#endif goto done; case GST_EVENT_SEGMENT: @@ -2447,8 +2514,15 @@ gst_multi_queue_sink_query (GstPad * pad, GstObject * parent, GstQuery * query) GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); res = gst_data_queue_push (sq->queue, (GstDataQueueItem *) item); GST_MULTI_QUEUE_MUTEX_LOCK (mq); +#ifdef TIZEN_FEATURE_MQ_MODIFICATION + if (!res || sq->flushing) { + gst_multi_queue_item_destroy (item); + goto out_flushing; + } +#else if (!res || sq->flushing) goto out_flushing; +#endif /* it might be that the query has been taken out of the queue * while we were unlocked. So, we need to check if the last * handled query is the same one than the one we just @@ -2738,6 +2812,10 @@ compute_high_time (GstMultiQueue * mq, guint groupid) #define IS_FILLED(q, format, value) (((q)->max_size.format) != 0 && \ ((q)->max_size.format) <= (value)) +#ifdef TIZEN_FEATURE_MQ_MODIFICATION_EXTRA_SIZE_TIME +#define IS_FILLED_EXTRA(q, format, value) ((((q)->extra_size.format) != 0) && (((q)->max_size.format) != 0) && \ + (((q)->extra_size.format)+((q)->max_size.format)) <= (value)) +#endif /* * GstSingleQueue functions */ @@ -2872,7 +2950,11 @@ single_queue_check_full (GstDataQueue * dataq, guint visible, guint bytes, return TRUE; /* check time or bytes */ +#ifdef TIZEN_FEATURE_MQ_MODIFICATION_EXTRA_SIZE_TIME + res = IS_FILLED_EXTRA (sq, time, sq->cur_time) || IS_FILLED (sq, bytes, bytes); +#else res = IS_FILLED (sq, bytes, bytes); +#endif /* We only care about limits in time if we're not a sparse stream or * we're not syncing by running time */ if (!sq->is_sparse || !mq->sync_by_running_time) {