[rygel] core: Don't preroll when seeking



commit 1c5b9e02721f3229d12ad85430a57ce7b56eeafc
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Apr 4 22:06:03 2011 +0300

    core: Don't preroll when seeking
    
    If we are seeking, we must not send out first prerolled buffers since seek
    event is sent to pipeline after it is in PAUSED state already and preroll
    has already happened. i-e we will be always sending out the beginning of
    the media if we execute the first preroll.

 src/rygel/rygel-http-gst-sink.vala |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/rygel/rygel-http-gst-sink.vala b/src/rygel/rygel-http-gst-sink.vala
index 6705014..76951c6 100644
--- a/src/rygel/rygel-http-gst-sink.vala
+++ b/src/rygel/rygel-http-gst-sink.vala
@@ -42,6 +42,8 @@ internal class Rygel.HTTPGstSink : BaseSink {
     private Mutex buffer_mutex;
     private Cond buffer_condition;
 
+    private bool render_preroll;
+
     static construct {
         var caps = new Caps.any ();
         var template = new PadTemplate (PAD_NAME,
@@ -54,6 +56,7 @@ internal class Rygel.HTTPGstSink : BaseSink {
     public HTTPGstSink (HTTPGstResponse response) {
         this.chunks_buffered = 0;
         this.bytes_sent = 0;
+        this.max_bytes = int64.MAX;
         this.buffer_mutex = new Mutex ();
         this.buffer_condition = new Cond ();
 
@@ -64,10 +67,14 @@ internal class Rygel.HTTPGstSink : BaseSink {
         this.sync = false;
         this.name = NAME;
 
-        if (response.seek != null && response.seek is HTTPByteSeek) {
-            this.max_bytes = response.seek.length;
+        if (response.seek != null) {
+            if (response.seek is HTTPByteSeek) {
+                this.max_bytes = response.seek.length;
+            }
+
+            this.render_preroll = false;
         } else {
-            this.max_bytes = int64.MAX;
+            this.render_preroll = true;
         }
 
         this.cancellable.cancelled.connect (this.on_cancelled);
@@ -79,7 +86,18 @@ internal class Rygel.HTTPGstSink : BaseSink {
     }
 
     public override FlowReturn preroll (Buffer buffer) {
-        return render (buffer);
+        if (this.render_preroll) {
+            return render (buffer);
+        } else {
+            // If we are seeking, we must not send out first prerolled buffers
+            // since seek event is sent to pipeline after it is in PAUSED state
+            // already and preroll has already happened. i-e we will be always
+            // sending out the beginning of the media if we execute the first
+            // preroll.
+            this.render_preroll = true;
+
+            return FlowReturn.OK;
+        }
     }
 
     public override FlowReturn render (Buffer buffer) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]