[rygel] core: Synchronous streaming of LiveResponse
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core: Synchronous streaming of LiveResponse
- Date: Tue, 12 Jan 2010 16:57:18 +0000 (UTC)
commit 0189add0b5c1d1aeb0c0d9e93ccff6290a7eafd2
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Jan 12 18:52:36 2010 +0200
core: Synchronous streaming of LiveResponse
Now we wait for the chunk to be actually sent to the client before
we process any more chunks from fakesink.
src/rygel/rygel-live-response.vala | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-live-response.vala b/src/rygel/rygel-live-response.vala
index b83f750..8713dc8 100644
--- a/src/rygel/rygel-live-response.vala
+++ b/src/rygel/rygel-live-response.vala
@@ -40,6 +40,8 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
private SourceFunc run_continue;
+ private MainLoop buffer_loop;
+
public LiveResponse (Soup.Server server,
Soup.Message msg,
string name,
@@ -52,6 +54,8 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
this.prepare_pipeline (name, src);
this.time_range = time_range;
+
+ this.buffer_loop = new MainLoop (null, false);
}
public override async void run () {
@@ -63,11 +67,15 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
}
this.run_continue = run.callback;
+ this.msg.wrote_chunk.connect (this.on_wrote_chunk);
yield;
}
public override void end (bool aborted, uint status) {
+ this.msg.wrote_chunk.disconnect (this.on_wrote_chunk);
+
+ this.buffer_loop.quit ();
this.pipeline.set_state (State.NULL);
if (!aborted) {
@@ -211,7 +219,17 @@ internal class Rygel.LiveResponse : Rygel.HTTPResponse {
private void on_new_buffer (Element sink,
Buffer buffer,
Pad pad) {
+ if (this.cancellable.is_cancelled ()) {
+ return;
+ }
+
this.push_data (buffer.data, buffer.size);
+
+ this.buffer_loop.run ();
+ }
+
+ private void on_wrote_chunk (Soup.Message msg) {
+ this.buffer_loop.quit ();
}
private bool bus_handler (Gst.Bus bus,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]