[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    [gst-cvs] gstreamer: queue2: download mode;
From:       mnauw () kemper ! freedesktop ! org (Mark Nauwelaerts)
Date:       2010-07-29 15:30:51
Message-ID: 20100729153051.D038E10057 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gstreamer
Branch: master
Commit: 2057cf6d79451e81a25babd9a8965bdc56c427b3
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=2057cf6d79451e81a25babd9a8965bdc56c427b3


Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Thu Jul 29 17:27:06 2010 +0200

queue2: download mode; prevent range corruption due to race

Current range was being updated in the thread performing seek, but as
no locks were kept for a short section, data flow could resume before
current range updated, so data for the new range would be accepted as
from the previous range.

Rather, range should be updated in serialized manner based on
newsegment event.

---

 plugins/elements/gstqueue2.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c
index 83af4b9..8f595a2 100644
--- a/plugins/elements/gstqueue2.c
+++ b/plugins/elements/gstqueue2.c
@@ -244,6 +244,9 @@ static GstStateChangeReturn gst_queue2_change_state (GstElement * \
element,  static gboolean gst_queue2_is_empty (GstQueue2 * queue);
 static gboolean gst_queue2_is_filled (GstQueue2 * queue);
 
+static void update_cur_level (GstQueue2 * queue, GstQueue2Range * range);
+
+
 /* static guint gst_queue2_signals[LAST_SIGNAL] = { 0 }; */
 
 static void
@@ -648,6 +651,12 @@ apply_segment (GstQueue2 * queue, GstEvent * event, GstSegment * \
segment)  G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
 
   if (format == GST_FORMAT_BYTES) {
+    if (QUEUE_IS_USING_TEMP_FILE (queue)) {
+      /* start is where we'll be getting from and as such writing next */
+      queue->current = add_range (queue, start);
+      /* update the stats for this range */
+      update_cur_level (queue, queue->current);
+    }
   }
 
   /* now configure the values, we use these to track timestamps on the
@@ -1012,11 +1021,6 @@ perform_seek_to_offset (GstQueue2 * queue, guint64 offset)
   res = gst_pad_push_event (queue->sinkpad, event);
   GST_QUEUE2_MUTEX_LOCK (queue);
 
-  if (res) {
-    queue->current = add_range (queue, offset);
-    /* update the stats for this range */
-    update_cur_level (queue, queue->current);
-  }
   return res;
 }
 


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
gstreamer-cvs mailing list
gstreamer-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic