Always include Content-Range if size of item is known.
authorZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Tue, 13 Jan 2009 14:32:56 +0000 (14:32 +0000)
committerZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Tue, 13 Jan 2009 14:32:56 +0000 (14:32 +0000)
DLNA requirement 7.4.35.7.

svn path=/trunk/; revision=429

src/rygel/rygel-streamer.vala

index 039b87d..b31f3ad 100644 (file)
@@ -177,13 +177,23 @@ public class Rygel.Streamer : GLib.Object {
             msg.response_headers.append ("Accept-Ranges", "bytes");
         }
 
-        if (seek != null) {
+        if (item.res.size > 0) {
+            int64 first_byte;
+            int64 last_byte;
+
+            if (seek != null) {
+                first_byte = seek.start;
+                last_byte = seek.stop;
+            } else {
+                first_byte = 0;
+                last_byte = item.res.size - 1;
+            }
+
             // Content-Range: bytes START_BYTE-STOP_BYTE/TOTAL_LENGTH
             var content_range = "bytes " +
-                                seek.start.to_string () + "-" +
-                                seek.stop.to_string () + "/" +
+                                first_byte.to_string () + "-" +
+                                last_byte.to_string () + "/" +
                                 item.res.size.to_string ();
-
             msg.response_headers.append ("Content-Range", content_range);
         }
     }