Revert "core: Push data directly from gst thread"
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 18 Jan 2010 16:54:55 +0000 (18:54 +0200)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 18 Jan 2010 16:54:55 +0000 (18:54 +0200)
This reverts commit e5cfcf87fc4bf3f2e82b860ec95388e84f8410f7.

Conflicts:

src/rygel/rygel-live-response.vala

src/rygel/rygel-live-response.vala

index 7b90f6d..1680e88 100644 (file)
@@ -38,6 +38,7 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
 
     private HTTPSeek time_range;
 
+    private uint idle_id;
     private SourceFunc run_continue;
 
     public LiveResponse (Soup.Server  server,
@@ -70,6 +71,11 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
     public override void end (bool aborted, uint status) {
         this.pipeline.set_state (State.NULL);
 
+        if (this.idle_id != 0) {
+           Source.remove (this.idle_id);
+           this.idle_id = 0;
+        }
+
         if (!aborted) {
             this.msg.response_body.complete ();
         }
@@ -152,7 +158,14 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
     private void on_new_buffer (Element sink,
                                 Buffer  buffer,
                                 Pad     pad) {
-        this.push_data (buffer.data, buffer.size);
+        this.idle_id = Idle.add_full (Priority.HIGH_IDLE,
+                                      () => {
+            this.push_data (buffer.data, buffer.size);
+
+            this.idle_id = 0;
+
+            return false;
+        });
     }
 
     private bool bus_handler (Gst.Bus     bus,