rygel r481 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r481 - trunk/src/rygel
- Date: Wed, 28 Jan 2009 12:32:10 +0000 (UTC)
Author: zeeshanak
Date: Wed Jan 28 12:32:10 2009
New Revision: 481
URL: http://svn.gnome.org/viewvc/rygel?rev=481&view=rev
Log:
Decide priority based on requested transfer mode.
Modified:
trunk/src/rygel/rygel-seekable-response.vala
Modified: trunk/src/rygel/rygel-seekable-response.vala
==============================================================================
--- trunk/src/rygel/rygel-seekable-response.vala (original)
+++ trunk/src/rygel/rygel-seekable-response.vala Wed Jan 28 12:32:10 2009
@@ -32,6 +32,8 @@
private char[] buffer;
private size_t length;
+ int priority;
+
public SeekableResponse (Soup.Server server,
Soup.Message msg,
string uri,
@@ -41,6 +43,7 @@
this.seek = seek;
this.length = file_length;
+ this.priority = this.get_requested_priority ();
if (seek != null) {
this.length = (size_t) seek.length;
@@ -51,7 +54,7 @@
this.buffer = new char[this.length];
this.file = File.new_for_uri (uri);
- this.file.read_async (Priority.DEFAULT, null, this.on_file_read);
+ this.file.read_async (this.priority, null, this.on_file_read);
}
private void on_file_read (GLib.Object source_object,
@@ -85,7 +88,7 @@
input_stream.read_async (this.buffer,
this.length,
- Priority.DEFAULT,
+ this.priority,
null,
on_contents_read);
}
@@ -106,7 +109,7 @@
this.push_data (this.buffer, this.length);
- input_stream.close_async (Priority.DEFAULT,
+ input_stream.close_async (this.priority,
null,
on_input_stream_closed);
}
@@ -125,5 +128,19 @@
this.end (false, Soup.KnownStatusCode.NONE);
}
+
+ private int get_requested_priority () {
+ var mode = this.msg.request_headers.get ("transferMode.dlna.org");
+
+ if (mode == null || mode == "Interactive") {
+ return Priority.DEFAULT;
+ } else if (mode == "Streaming") {
+ return Priority.HIGH;
+ } else if (mode == "Background") {
+ return Priority.LOW;
+ } else {
+ return Priority.DEFAULT;
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]