core: Push data directly from gst thread
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Tue, 12 Jan 2010 15:57:19 +0000 (17:57 +0200)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Tue, 12 Jan 2010 15:57:19 +0000 (17:57 +0200)
Instead of registering an idle func to push data, simply push it directly
from the gst thread. We only need to be sure that nobody else accesses
the message from the main thread while we do this.

src/rygel/rygel-live-response.vala

index 8c57af8..bd447ee 100644 (file)
@@ -38,7 +38,6 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
 
     private HTTPSeek time_range;
 
-    private uint idle_id;
     private SourceFunc continuation;
 
     public LiveResponse (Soup.Server  server,
@@ -71,11 +70,6 @@ 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 ();
         }
@@ -217,14 +211,7 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
     private void on_new_buffer (Element sink,
                                 Buffer  buffer,
                                 Pad     pad) {
-        this.idle_id = Idle.add_full (Priority.HIGH_IDLE,
-                                      () => {
-            this.push_data (buffer.data, buffer.size);
-
-            this.idle_id = 0;
-
-            return false;
-        });
+        this.push_data (buffer.data, buffer.size);
     }
 
     private bool bus_handler (Gst.Bus     bus,