Re: Issue with "bytes" Range Unit and live streaming

Craig Pratt <craig@ecaspia.com> Fri, 15 April 2016 19:42 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E4F4E12D86F for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 15 Apr 2016 12:42:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.193
X-Spam-Level:
X-Spam-Status: No, score=-7.193 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.723, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.996, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=ecaspia-com.20150623.gappssmtp.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LFKQ6ka3uq6i for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 15 Apr 2016 12:41:59 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DF2D312D827 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 15 Apr 2016 12:41:57 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1ar9Y1-00009P-4Z for ietf-http-wg-dist@listhub.w3.org; Fri, 15 Apr 2016 19:36:57 +0000
Resent-Date: Fri, 15 Apr 2016 19:36:57 +0000
Resent-Message-Id: <E1ar9Y1-00009P-4Z@frink.w3.org>
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <craig@caspiaconsulting.com>) id 1ar9Xu-00008d-PV for ietf-http-wg@listhub.w3.org; Fri, 15 Apr 2016 19:36:50 +0000
Received: from mail-pf0-f170.google.com ([209.85.192.170]) by lisa.w3.org with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.80) (envelope-from <craig@caspiaconsulting.com>) id 1ar9Xs-00067S-JB for ietf-http-wg@w3.org; Fri, 15 Apr 2016 19:36:50 +0000
Received: by mail-pf0-f170.google.com with SMTP id n1so59733066pfn.2 for <ietf-http-wg@w3.org>; Fri, 15 Apr 2016 12:36:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ecaspia-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:organization:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=Bm0JExUrZkDwXjtWArGtciC/PfvGuV6BSt70rV1wCHI=; b=AZh/rKMB23t76pj0+14alez8D5oZDHvjM5rHpDlK6Wh/VLBr383gpQH1ZbLuLfUkPg 9TvVLw4C+Yj2CJriaArsE4gG007hMKKFyT7LfvsHfjftKtNP3bFFTOkca6/YOhSK0tya 5UeKnpdIavtlJw+puE0r01MYq74uCnU5/azZKbY05HSpl9Nbx71o/sH57qmnebxf6GsT lkHYcLx6+n6Z+5Ss8zUgKV6neksefDLa7aqAZYePGMglFCd4ucQZ2/0YVmCgiC9UweIm d77rhLYEG7wjC4eTivPFpB7CVpBU9ZX1URPxzJxoNH2V0KUECOrIMwL5N3bwnlQMRjYM jvew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding; bh=Bm0JExUrZkDwXjtWArGtciC/PfvGuV6BSt70rV1wCHI=; b=CXCSjwhZI+suV3p8WArC6la6gkIOJWQmLXrqkBtqbr734O2Qpl5pelKybrmhUSsLlU nXdrzu/u1lCT7ujEYExh2PuDSoCvS0wkv6XgaCXsT22MB4d/YABjrNZ9GQ24Nr1fLF4z CJGEKOBh17DeZvBjZmuciy8ICugPH0/d/T9BSI8zKu6wlnDJK3tTUxKVYT/Dr9c2Vh7m Y608C052UcynEDZwUUeUSiaDNV3kMaukwIWgbedbyx9nJBdULDc/Oau9hCpc9h3u9fNI jfsFFo/8Plme8WcAOi8WWKQj8305PBXi0NwrlPM7oChIdx0c5bn4UPH6MPurpMxo4lEX 6mdg==
X-Gm-Message-State: AOPr4FXdsRHGof4CeN3/BNR3de93L5+QvYECwhTbwaQbOxLHHQiaETR3OKBTIZxaajP29g==
X-Received: by 10.98.27.208 with SMTP id b199mr21779333pfb.49.1460748981768; Fri, 15 Apr 2016 12:36:21 -0700 (PDT)
Received: from [10.10.1.104] (50-193-209-61-static.hfc.comcastbusiness.net. [50.193.209.61]) by smtp.googlemail.com with ESMTPSA id bb5sm21251438pac.21.2016.04.15.12.36.20 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Apr 2016 12:36:20 -0700 (PDT)
To: Remy Lebeau <remy@lebeausoftware.org>, IETF HTTP BIS <ietf-http-wg@w3.org>
References: <57102718.7010900@ecaspia.com> <571041E0.5020401@lebeausoftware.org>
From: Craig Pratt <craig@ecaspia.com>
Organization: Caspia Consulting
Message-ID: <571142B5.7050501@ecaspia.com>
Date: Fri, 15 Apr 2016 12:36:21 -0700
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <571041E0.5020401@lebeausoftware.org>
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=209.85.192.170; envelope-from=craig@caspiaconsulting.com; helo=mail-pf0-f170.google.com
X-W3C-Hub-Spam-Status: No, score=-3.9
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.723, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: lisa.w3.org 1ar9Xs-00067S-JB 81ecabed0e41129d320c12ed454fa07f
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Issue with "bytes" Range Unit and live streaming
Archived-At: <http://www.w3.org/mid/571142B5.7050501@ecaspia.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/31480
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

Barbara did a good job providing some needed context. But I want to respond to the "jump to live" aspect (below).

cp

On 4/14/16 6:20 PM, Remy Lebeau wrote:
AFAICT, the existing ABNF for byte ranges *does* already support what you are looking for, without having to introduce a new unit type:

    byte-range-spec = first-byte-pos "-" [ last-byte-pos ]

Simply omit the * and leave the second value empty:

    Range: bytes=1234567-

RFC 2616 Section 14.35.1 says:

"If the last-byte-pos value is absent, or if the value is greater than or equal to the current length of the entity-body, last-byte-pos is taken to be equal to one less than the current length of the entity- body in bytes."

RFC 7233 Section 2.1 says:

"If the last-byte-pos value is absent, or if the value is greater than or equal to the current length of the representation data, the byte range is interpreted as the remainder of the representation (i.e., the server replaces the value of last-byte-pos with a value that is one less than the current length of the selected representation)."

Since the media is being recorded while streaming, the client can randomly jump around within the recorded portion of the media all it wants. Once jumped, it would simply be receiving media from the recording, not the live feed.  To jump back to the live feed, simply omit the "Range" header.

Remy Lebeau
Lebeau Software
[cp] There are a couple of issues with the above usage model (which we definitely considered and discussed)

(1) The GET request (without a Range header) is typically expected to transfer the entire representation. In the kind of in-progress recording example, this means the transfer would start from the first recorded byte (and not the live point). While there might be some room for various interpretations, our use case is constrained by the DLNA specifications here (and implementations based on it). The spec and endpoints expect Range-less transfers to start at the beginning of the representation. And really, if there is ambiguity on the GET response, I'd rather not make assumptions one way or the other.

(2) Even if a server returned live data from a Range-less GET, you can end up with data discontinuity. For instance, say you want to jump ahead in the stream - through the random access portion and into the live data. Under this model, I might perform a Range request with "bytes=1234567-", process the data, and then jump to the live point once I'd consumed that response. Well, no matter how small I make that Range request, data could have been added between the time I did the "bytes=1234567-" request and I jump to the live point. Since the client can't know/detect this discontinuity, it has to be implemented assuming the worst - flushing the framebuffer, resetting the rendering state, and waiting for the next keyframe - which can be seconds away.
In fact, and in general, jumping to live on a video stream like this is best accomplished by performing a request that precedes the end of the stream. This is due to this dependance on a key frame to initialize rendering. Being able to capture the most recent key frame can make a difference of seconds in initial presentation of a live stream. But it definitely requires continuity - which is what the bytes-live range unit is intended to provide.

I hadn't made much of this "discontinuity" aspect in the RFC. Please let me know if you think it deserves more attention/explanation. And thanks much for the thoughts.

Happy Friday,

cp

On 4/14/2016 4:26 PM, Craig Pratt wrote:
Hello all,

We have a use case where we are "live streaming" media over HTTP. As with other (non-segmented) HTTP streaming applications, our live streaming solution has the HTTP client perform a GET on a URI representing the live audio or video content stream and with the server progressively returning data using chunked transfer coding. The data returned to the server is "live" so long as the client reads data as quickly as it's generated - with TCP flow control allowing the client's reading of the response data to be paced to the live chunk generation of the HTTP server.

More recently, use cases have appeared that require a combination of random access and live streaming. For example, an HTTP media server may want to support streaming of an in-progress recording - with the HTTP client using HTTP byte Range requests to access any point within the already-recorded content. But we've run into issues supporting both live content transfer and HTTP byte Range requests on the same resource. There's no good way that we've found to get to this "live point" and also support random access. The use case requires a byte range that ends at an indeterminate point, e.g.

    Range: bytes=1234567-*

However, the ABNF for the bytes Range Unit doesn't allow for this form of request.

Rather than coming up with a proprietary solution, we are proposing a new Range Unit called "bytes-live" as a potential solution to this issue. Support for this new "bytes-live" Range Unit could be exposed by servers (using the Accept-Ranges header) for content that support both byte-wise random access and live streaming. e.g. A server that supports both the standard HTTP/1.1 bytes Range Unit and bytes-live would include the header:

    Accept-Ranges: bytes bytes-live

An HTTP client can use Range requests with the standard "bytes" Range Unit to transfer stored content from a representation. And when the bytes-live Range Unit is supported, an HTTP client can request a byte range that starts or ends at the live point of the content representation. For example, a client could request the transfer of bytes starting at byte 1234567 and transitioning to the live point once all stored content has been transferred using:

    Range: bytes-live=1234567-*

We believe the bytes-live Range Unit could have multiple applications outside of our immediate use cases. For instance, internet-connected video cameras with on-board storage could use bytes-live to support streaming of continuously recording content with lower latencies than can be achieved using HLS, MPEG-DASH, or other segmented video streaming techniques. And there are also applications with on-demand transcoding.

The draft RFC can be found here https://tools.ietf.org/html/draft-pratt-httpbis-bytes-live-range-unit-00" rel="nofollow">https://tools.ietf.org/html/draft-pratt-httpbis-bytes-live-range-unit-00. Please let me know what you think - and if there are other solutions we haven't considered.

Regards,

craig
--

craig pratt

Caspia Consulting

craig@ecaspia.com

503.746.8008







--

craig pratt

Caspia Consulting

craig@ecaspia.com

503.746.8008