queue2: remove file buffering patch 92/225492/2
authorEunhye Choi <eunhae1.choi@samsung.com>
Thu, 20 Feb 2020 07:41:05 +0000 (16:41 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Fri, 21 Feb 2020 05:43:23 +0000 (14:43 +0900)
- tizen do not use file buffering.
  remove the file buffering related patches.

Change-Id: I0563fe6d9dcb777f7ad7baa237416a6ff563cf6c

plugins/elements/gstqueue2.c
plugins/elements/gstqueue2.h

index a2c9538..b2c22c7 100644 (file)
@@ -310,9 +310,6 @@ static void update_cur_level (GstQueue2 * queue, GstQueue2Range * range);
 static void update_in_rates (GstQueue2 * queue, gboolean force);
 static GstMessage *gst_queue2_get_buffering_message (GstQueue2 * queue);
 static void gst_queue2_post_buffering (GstQueue2 * queue);
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-static gboolean change_current_range(GstQueue2 * queue, GstQueue2Range *req_range, guint64 offset, guint length);
-#endif
 
 typedef enum
 {
@@ -646,9 +643,6 @@ clean_ranges (GstQueue2 * queue)
   g_slice_free_chain (GstQueue2Range, queue->ranges, next);
   queue->ranges = NULL;
   queue->current = NULL;
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-  queue->read = NULL;
-#endif
 }
 
 /* find a range that contains @offset or NULL when nothing does */
@@ -759,11 +753,7 @@ init_ranges (GstQueue2 * queue)
   /* get rid of all the current ranges */
   clean_ranges (queue);
   /* make a range for offset 0 */
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-  queue->current = queue->read = add_range (queue, 0, TRUE);
-#else
   queue->current = add_range (queue, 0, TRUE);
-#endif
 }
 
 /* calculate the diff between running time on the sink and src of the queue.
@@ -807,11 +797,7 @@ apply_segment (GstQueue2 * queue, GstEvent * event, GstSegment * segment,
   if (segment->format == GST_FORMAT_BYTES) {
     if (!QUEUE_IS_USING_QUEUE (queue) && is_sink) {
       /* start is where we'll be getting from and as such writing next */
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-      queue->current = queue->read = add_range (queue, segment->start, TRUE);
-#else
       queue->current = add_range (queue, segment->start, TRUE);
-#endif
     }
   }
 
@@ -1221,23 +1207,11 @@ static void
 update_buffering (GstQueue2 * queue)
 {
   gint buffering_level, percent;
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-  GstQueue2Range *range;
-
-  if (queue->read)
-    range = queue->read;
-  else
-    range = queue->current;
-#endif
 
   /* Ensure the variables used to calculate buffering state are up-to-date. */
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-  if (range)
-    update_cur_level (queue, range);
-#else
   if (queue->current)
     update_cur_level (queue, queue->current);
-#endif
+
   update_in_rates (queue, FALSE);
 
   if (!get_buffering_level (queue, NULL, &buffering_level))
@@ -1432,11 +1406,7 @@ perform_seek_to_offset (GstQueue2 * queue, guint64 offset)
      * cause data to be written to the wrong offset in the file or ring buffer.
      * We still do the add_range call to switch the current range to the
      * requested range, or create one if one doesn't exist yet. */
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-    queue->current = queue->read = add_range (queue, offset, FALSE);
-#else
     queue->current = add_range (queue, offset, FALSE);
-#endif
   }
 
   return res;
@@ -1458,67 +1428,19 @@ get_seek_threshold (GstQueue2 * queue)
   return threshold;
 }
 
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-/* check the buffered data size, not to change range repeatedly.
- * changing range cause the new http connection and it makes buffering state frequently. */
-static gboolean
-change_current_range(GstQueue2 * queue, GstQueue2Range *req_range, guint64 offset, guint length)
-{
-  guint64 curr_level = 0;
-  guint64 curr_min_level = 0;
-
-  if (queue->current->writing_pos > queue->current->reading_pos)
-    curr_level = queue->current->writing_pos - queue->current->reading_pos;
-
-  /* FIXME, find a good threshold based on the incoming rate and content bitrate. */
-  curr_min_level = MIN((queue->max_level.bytes*0.05), get_seek_threshold(queue));
-
-  GST_DEBUG_OBJECT(queue, " curr[w%"G_GUINT64_FORMAT", r%"G_GUINT64_FORMAT
-        ", d%"G_GUINT64_FORMAT", m%"G_GUINT64_FORMAT
-        "] u[%"G_GUINT64_FORMAT"][EOS:%d]",
-        queue->current->writing_pos, queue->current->reading_pos,
-        curr_level, curr_min_level,
-        queue->upstream_size, queue->is_eos);
-
-  /* FIXME, find a good threshold based on the incoming rate and content bitrate. */
-  if ((queue->is_eos) ||
-      (queue->upstream_size > 0 && queue->current->writing_pos >= queue->upstream_size) ||
-      (curr_level >= curr_min_level)) {
-    GST_DEBUG_OBJECT (queue, "Range Switching");
-    return TRUE;
-  } else {
-    GST_DEBUG_OBJECT (queue, "keep receiving data without range switching.");
-    return FALSE;
-  }
-}
-#endif
-
 /* see if there is enough data in the file to read a full buffer */
 static gboolean
 gst_queue2_have_data (GstQueue2 * queue, guint64 offset, guint length)
 {
   GstQueue2Range *range;
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-  gboolean need_to_seek = TRUE;
-#endif
+
   GST_DEBUG_OBJECT (queue, "looking for offset %" G_GUINT64_FORMAT ", len %u",
       offset, length);
 
   if ((range = find_range (queue, offset))) {
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-    queue->read = range;
-#endif
     if (queue->current != range) {
       GST_DEBUG_OBJECT (queue, "switching ranges, do seek to range position");
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-      if (QUEUE_IS_USING_TEMP_FILE(queue) && !QUEUE_IS_USING_RING_BUFFER(queue))
-        need_to_seek = change_current_range(queue, range, offset, length);
-
-      if (need_to_seek == TRUE)
-        perform_seek_to_offset (queue, range->writing_pos);
-#else
       perform_seek_to_offset (queue, range->writing_pos);
-#endif
     }
 
     GST_INFO_OBJECT (queue, "cur_level.bytes %u (max %" G_GUINT64_FORMAT ")",
@@ -1543,10 +1465,6 @@ gst_queue2_have_data (GstQueue2 * queue, guint64 offset, guint length)
     GST_INFO_OBJECT (queue, "not found in any range off %" G_GUINT64_FORMAT
         " len %u", offset, length);
 
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-    queue->read = queue->current;
-#endif
-
     /* we don't have the range, see how far away we are */
     if (!queue->is_eos && queue->current) {
       guint64 threshold = get_seek_threshold (queue);
@@ -1670,24 +1588,15 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
         guint64 level;
 
         /* calculate how far away the offset is */
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-        if (queue->read->writing_pos > rpos)
-          level = queue->read->writing_pos - rpos;
-#else
         if (queue->current->writing_pos > rpos)
           level = queue->current->writing_pos - rpos;
-#endif
         else
           level = 0;
 
         GST_DEBUG_OBJECT (queue,
             "reading %" G_GUINT64_FORMAT ", writing %" G_GUINT64_FORMAT
             ", level %" G_GUINT64_FORMAT ", max %" G_GUINT64_FORMAT,
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-            rpos, queue->read->writing_pos, level, max_size);
-#else
             rpos, queue->current->writing_pos, level, max_size);
-#endif
 
         if (level >= max_size) {
           /* we don't have the data but if we have a ring buffer that is full, we
@@ -1712,17 +1621,10 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
 
       if (read_length == 0) {
         if (QUEUE_IS_USING_RING_BUFFER (queue)) {
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-          GST_DEBUG_OBJECT (queue,
-              "update current position [%" G_GUINT64_FORMAT "-%"
-              G_GUINT64_FORMAT "]", rpos, queue->read->max_reading_pos);
-          update_cur_pos (queue, queue->read, rpos);
-#else
           GST_DEBUG_OBJECT (queue,
               "update current position [%" G_GUINT64_FORMAT "-%"
               G_GUINT64_FORMAT "]", rpos, queue->current->max_reading_pos);
           update_cur_pos (queue, queue->current, rpos);
-#endif
           GST_QUEUE2_SIGNAL_DEL (queue);
         }
 
@@ -1739,22 +1641,15 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
     }
 
     /* set range reading_pos to actual reading position for this read */
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-    queue->read->reading_pos = rpos;
-#else
     queue->current->reading_pos = rpos;
-#endif
+
 
     /* configure how much and from where to read */
     if (QUEUE_IS_USING_RING_BUFFER (queue)) {
       file_offset =
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-          (queue->read->rb_offset + (rpos -
-              queue->read->offset)) % rb_size;
-#else
           (queue->current->rb_offset + (rpos -
               queue->current->offset)) % rb_size;
-#endif
+
       if (file_offset + read_length > rb_size) {
         block_length = rb_size - file_offset;
       } else {
@@ -1784,13 +1679,8 @@ gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
       block_length = read_length;
       remaining -= read_return;
 
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-      rpos = (queue->read->reading_pos += read_return);
-      update_cur_pos (queue, queue->read, queue->read->reading_pos);
-#else
       rpos = (queue->current->reading_pos += read_return);
       update_cur_pos (queue, queue->current, queue->current->reading_pos);
-#endif
     }
     GST_QUEUE2_SIGNAL_DEL (queue);
     GST_DEBUG_OBJECT (queue, "%u bytes left to read", remaining);
@@ -1858,11 +1748,8 @@ gst_queue2_read_item_from_file (GstQueue2 * queue)
     GstBuffer *buffer = NULL;
     guint64 reading_pos;
 
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-    reading_pos = queue->read->reading_pos;
-#else
+
     reading_pos = queue->current->reading_pos;
-#endif
 
     ret =
         gst_queue2_create_read (queue, reading_pos, DEFAULT_BUFFER_SIZE,
index f78db50..4f45a46 100644 (file)
@@ -153,9 +153,7 @@ struct _GstQueue2
   /* list of downloaded areas and the current area */
   GstQueue2Range *ranges;
   GstQueue2Range *current;
-#ifdef TIZEN_FEATURE_QUEUE2_MODIFICATION
-  GstQueue2Range *read;
-#endif
+
   /* we need this to send the first new segment event of the stream
    * because we can't save it on the file */
   gboolean segment_event_received;