From cb231e73c6faa9492bc1c63f04350b9e458d6949 Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Tue, 13 Jan 2009 14:32:56 +0000 Subject: [PATCH] Always include Content-Range if size of item is known. DLNA requirement 7.4.35.7. svn path=/trunk/; revision=429 --- src/rygel/rygel-streamer.vala | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/rygel/rygel-streamer.vala b/src/rygel/rygel-streamer.vala index 039b87d..b31f3ad 100644 --- a/src/rygel/rygel-streamer.vala +++ b/src/rygel/rygel-streamer.vala @@ -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); } } -- 2.7.4