[rygel] core: Refactor GstSink.render()



commit 54aa5253223044e9f5a0be01361d4064534a7cfa
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Mar 23 16:00:57 2011 +0200

    core: Refactor GstSink.render()
    
    Put code that runs in main thread/loop that actually pushes data to
    client, into a separate method.

 src/rygel/rygel-http-gst-sink.vala |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/rygel/rygel-http-gst-sink.vala b/src/rygel/rygel-http-gst-sink.vala
index b92c5d7..ae742e9 100644
--- a/src/rygel/rygel-http-gst-sink.vala
+++ b/src/rygel/rygel-http-gst-sink.vala
@@ -87,18 +87,24 @@ internal class Rygel.HTTPGstSink : BaseSink {
         }
 
         Idle.add_full (this.priority, () => {
-            if (this.cancellable.is_cancelled ()) {
-                return false;
-            }
-
-            this.response.push_data (buffer.data);
-            this.buffered++;
-            return false;
+            return this.push_data (buffer);
         });
 
         return FlowReturn.OK;
     }
 
+    // Runs in application thread
+    public bool push_data (Buffer buffer) {
+        if (this.cancellable.is_cancelled ()) {
+            return false;
+        }
+
+        this.response.push_data (buffer.data);
+        this.buffered++;
+
+        return false;
+    }
+
     private void on_wrote_chunk (Soup.Message msg) {
         this.buffer_mutex.lock ();
         this.buffered--;



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