<?xml version="1.0" encoding="utf-8"?>
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
<rfc version="3" ipr="trust200902" docName="draft-jennings-moq-quicr-proto-00" submissionType="IETF" category="info" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" indexInclude="false" consensus="true">

<front>
<title abbrev="quicr">QuicR - Media Delivery Protocol over QUIC</title><seriesInfo value="draft-jennings-moq-quicr-proto-00" stream="IETF" status="informational" name="Internet-Draft"></seriesInfo>
<author initials="C." surname="Jennings" fullname="Cullen Jennings"><organization>cisco</organization><address><postal><street></street>
<country>Canada</country>
</postal><email>fluffy@iii.ca</email>
</address></author><author initials="S." surname="Nandakumar" fullname="Suhas Nandakumar"><organization>Cisco</organization><address><postal><street></street>
</postal><email>snandaku@cisco.com</email>
</address></author><date/>
<area>transport</area>
<workgroup></workgroup>
<keyword>realtime</keyword>
<keyword>quicr</keyword>

<abstract>
<t>Recently new usecases have emerged requiring higher scalability of
delivery for interactive realtime applications and much lower latency for streaming applications and a combination thereof.
draft-jennings-moq-quicr-arch specifies architectural aspects of
QuicR, a media delivery protocol based on publish/subscribe metaphor and Relay based delivery tree, that enables a wide range
of realtime applications with different resiliency and latency needs.</t>
<t>This specification defines the protocol aspects of the QuicR architecture.</t>
</abstract>

</front>

<middle>

<section anchor="introduction"><name>Introduction</name>
<t>Recently new usecases have emerged requiring higher scalability of
delivery for interactive realtime applications and much lower latency
for streaming applications and a combination thereof. On one side are
use cases such as normal web conferences wanting to distribute out to
millions of viewers and allow viewers to instantly move to
being a presenter. On the other side are usescases such as streaming a
soccer game to millions of people including people in the stadium
watching the game live. Viewers watching an e-sports event want to be
able to comment with low latency to ensure the interactivity aspects
between what different viewers are seeing. All of these usescases
push towards latencies that are in the order of 100ms over the
natural latency the network causes.</t>
<t>The architecture for this specification is outlined in
draft-jennings-moq-quicr-arch, where the principal idea is
that the Client endpoints publish and subscribe to named objects that
is sent to, and received from, relays that forms an overlay
delivery network similar to what CDN provides today.</t>
<t>The architecture specification, draft-jennings-moq-quicr-arch, is a
prequisite to read this specification.</t>
<t>This specification defines the protocol specifics of the
QuicR Architecture.</t>
</section>

<section anchor="contributing"><name>Contributing</name>
<t>All significant discussion of development of this protocol is in the
GitHub issue tracker at: <tt>
https://github.com/fluffy/draft-jennings-moq-proto</tt></t>
</section>

<section anchor="terminology"><name>Terminology</name>

<ul>
<li><t>Relay Function: Functionality of the QuicR architecture, that
implements store and forward behavior at the minimum. Such a function
typically receives subscriptions and publishes data to the other
endpoints that have subscribed to the named data. Such functions may
cache the data as well for optimizing the delivery experience.</t>
</li>
<li><t>Relay: Server component (physical/logical) in the cloud that
implements the Relay Function.</t>
</li>
<li><t>Publisher: An endpoint that sends named objects to a
Relay. [ also referred to as producer of the named object]</t>
</li>
<li><t>Subscriber: An endpoint that subscribes and receives the named
objects. Relays can act as subscribers to other relays. Subscribers
can also be referred to as consumers.</t>
</li>
<li><t>Client/QuicR Client: An endpoint that acts as a Publisher, Subscriber,
or both. May also implement a Relay Function in certain contexts.</t>
</li>
<li><t>Named Object: Application level chunk of Data that has a unique Name,
a limited lifetime, priority and is transported via this protocol.</t>
</li>
<li><t>Origin server: Component managing the QuicR namespace for a specific
application and is responsible for establishing trust between clients
and relays. Origin servers can implement other QuicR functions.</t>
</li>
</ul>
</section>

<section anchor="quicr-protocol"><name>QuicR Protocol</name>

<section anchor="publish-api-and-publish-message"><name>Publish API and PUBLISH  Message</name>
<t>Entities the want to send named objects will use Publish API to
trigger <tt>PUBLISH</tt> messages from a QuicR client to the Origin server
(via Relay(s) if present). The publish message identifies active flow
of named objects, such a data can be originating from a given QuicR
endpoint client or a might be relayed by other entities. In the latter
case, the relaying entity MUST NOT change the name associated with
the object being published unless the intermediary is a publisher.
All the publishes MUST be authorized by the Origin server for</t>
<t>In general, the Publish API specifies following thing about
the named objects being published.</t>

<artwork>  NAME           (String)
  RELIABLE       (Boolean)
  PRIORITY       (Enumeration)
  BESTBEFORE     (Number)
  TIMESTAMP      (Number)
  DISCARDABLE    (Boolean)
  Payload        (Bytes)
</artwork>

<ul>
<li><t>NAME: Every <tt>PUBLISH</tt> message MUST have a name to identify the
object to the QuicR components (relays/origin-server/other clients).</t>
</li>
<li><t>PAYLOAD: End-to-End encrypted application data associated with
the named object to be published (e.g audio sample, video frame,
game move), which are typically timestamped buffers of application data.</t>
</li>
<li><t>RELIABLE: Boolean flag to indicate the if QuicR should use
QUIC Streams (true value) or QUIC datagrams (false value).</t>
</li>
<li><t>BESTBEFORE:  Time to live defines the time after which the named
object can be discarded from the caches.</t>
</li>
<li><t>PRIORITY: Enumeration specifying relative priority of named objects
being published by this end-point. This can help Relay to make
dropping/caching decisions.</t>
</li>
<li><t>DISCARDABLE: Provides an hint to the relays for making drop decisions.</t>
</li>
</ul>
<t>The QuicR <tt>PUBLISH</tt> message(s) are represented as below and
are encapsulated in QUIC packets.</t>
<t><tt>A&gt; All the integer fields are variable length encoded</tt></t>

<artwork>PUBLISH {
  ORIGIN            (String) 
  NAME              (Number128)
  FLAGS             (Byte)
  FRAGMENT_ID       (Number16)
  BESTBEFORE        (Number64)
  TIMESTAMP         (Number64)
  PAYLOAD           (ByteArray)
}

Flags := Reserved (4) | IsDiscardable (1) | Priority (3)
</artwork>
</section>

<section anchor="subscribe-api-and-subscribe-message"><name>Subscribe API and SUBSCRIBE Message</name>
<t>Entities that intend to receive named objects will do so via
subscriptions to the named objects. The Subscribe API triggers
sending <tt>SUBSCRIBE</tt> messages. Subscriptions are sent from
the QuicR clients to the origin server(s) (via relays, if present)
and are typically processed by the relays. See {#relay_behavior}
for further details. All the subscriptions MUST be authorized.</t>
<t>Subscriptions are typically long-lived transactions and they stay
active until one of the following happens</t>

<ul>
<li>a client local policy dictates expiration of a subscription.</li>
<li>optionally, a server policy dicates subscription expiration.</li>
<li>the underlying transport is disconnected.</li>
</ul>
<t>When an explicit indication is preferred to indicate the expiry of
subscription, it is indicated via <tt>SUBSCRIPTION_EXPIRY</tt> message.</t>
<t>Until the subscription is active for a given name, the Relay(s)
should send named objects it receives to all the matching subscribers.
The Relays may optionally cache the objects.
A QuicR client can renew its subscriptions at any point by sending a
new <tt>SUBSCRIBE</tt> message to the Origin server. Such subscriptions
MUST refresh the existing subscriptions for that name. A renewal
period of 5 seconds is RECOMMENDED.</t>

<artwork>SUBSCRIBE {
  ORIGIN             (String) 
  SUBSCRIPTION_ID    (Number64) 
  NAMES              [NAME]
  INTENT             [Enumeration] 
}

NAME {
 name               (Number128)
 mask               (Number7)
}

</artwork>
<t>The <tt>ORIGIN</tt> field identifies the Origin server for which this
subscription is targeted. <tt>SUBSCRIPTION_ID</tt> is a randomly chosen
to identify the subscription by a given client and is
local to the client's session. <tt>NAMES</tt> identify the fully formed
names or wildcarded names along with the appropriate bitmask length.</t>
<t>The <tt>INTENT</tt> field specifies how the Relay should provide the
named objects to the client. Following options are defined for
the <tt>INTENT</tt></t>
<t>IMMEDIATE: Deliver any new objects it receives that match the name</t>
<t>CATHCH_UP: Deliver any new objects it receives and in addition send any previous
objects it has received that are in the same group that matches the name.</t>
<t>WAIT_UP: Wait until an object that has a objectId that matches the name is
received then start sending any objects that match the name.</t>
<t>MOST_RECENT: Deliver any new objects it receives and in addition send
the most recent object it has received that is in the same group that
matches the name.</t>

<section anchor="aggregating-subscriptions"><name>Aggregating Subscriptions</name>
<t>Subscriptions are aggregated at entities that perform Relay Function.
Aggregating subscriptions helps reduce the number of subscriptions
for a given named objects in transit and also enables efficient
disrtibution of published media with minimal copies between the
client and the Origin server , as well as reduce the latencies when
there are multiple subscribers for a given named object behind a
common set of cloud server.</t>
</section>

<section anchor="wildcarded-names"><name>Wildcarded Names</name>
<t>The names used in <tt>SUBSCRIBE</tt> can be truncated by skipping the right
most segments of the name that is application specific, in which case it
will act as a wildcard subscription to all names that match the provided
part of the name. The same is indicated via bitmask associated
with the name in <tt>SUBSRIBE</tt> messages. Wildcard search on Relay(s) thus
turns into a bitmask at the appropriate bit location of the hashed name.</t>
<t>For example, in an web conferencing use case, the client
may subscribe to just the origin and meetingID to get all the media for a
particular conference.</t>
</section>
</section>

<section anchor="publish-intent-and-publish-intent-ok-message"><name>PUBLISH_INTENT and PUBLISH_INTENT_OK Message</name>
<t>The <tt>PUBLISH_INTENT</tt> message indicates the names chosen by a Publisher
for transmitting named objects within a session. This message is sent to
the Origin Server whenever a given publisher intends to publish on
a new name (which can be at the beginning of the session or during mid session).
This message is authorized by the Origin server and thus requires a mechanism
to setup the initial trust (via out of band) between the publisher and
the origin server.</t>
<t>A <tt>PUBLISH_INTENT</tt> message is represented as below:</t>

<artwork> PUBLISH_INTENT {
  ORIGIN         (String)
  PUBLISHER_ID   (Number64)
  NAMES          [Number64]
 }
</artwork>
<t>The <tt>ORIGIN</tt> field is used by the cloud Relays to choose the Origin
 server to forward the <tt>PUBLISH_INTENT</tt> message.</t>
<t>On a successful validation at the Origin server, a
 <tt>PUBLISH_INTENT_OK</tt> message is returned by the Origin server.</t>

<artwork> PUBLISH_INTENT_OK {
  PUBLISHER_ID   (Number64)
  NAMES          [Number64]
 }
</artwork>
<t>This message enables cloud relays to know the authorized names from a
 given Publisher. This helps to make caching decisions, dealing with collisions
 and so on.</t>
<t>A cloud relay may start caching the data associated with the names that has
 not been validated yet by the origin server and decide to flush its cache
 if no PUBLISH<em>INTENT</em>OK is received within a given implementation defined
 timeout. This is an optimization that would allow publishers to start
 transmitting the data without needing to wait a RTT.</t>
<t>Names chosen by the publishers MUST be unique with in a given session
 to avoid collisions. It is up to the application to define the necessary rules to
 ensure the uniqueness constraint. Cloud entities like Relays are agnostic
 to these rules and handle collisions by either overriding or dropping
 the associated data.</t>
</section>

<section anchor="subscribe-reply-message"><name>SUBSCRIBE_REPLY Message</name>
<t>A <tt>SUBSCRIBE_REPLY</tt> provides result of the subscriptions. It lists the
names that were successful in subscriptions and ones that failed to do so.</t>

<artwork>SUBSCRIBE_REPLY
{
    SUBSCRIPTION_ID     (Number64)
    NAMES_SUCCESS       [Number128]
    NAMES_FAIL          [Number128]
}
</artwork>
<t>Field SUBSCRIPTION_ID MUST match the equivalent field in
the <tt>SUBSCRIBE</tt> message to which this reply applies.</t>
</section>

<section anchor="subscribe-cancel-message"><name>SUBSCRIBE_CANCEL Message</name>
<t>A <tt>SUBSCRIBE_CANCEL</tt> message indicates a given subscription is no
longer valid. This message is an optional message and is sent to indicate
the peer about discontinued interest in a given named data.</t>

<artwork>SUBSCRIBE_CANCEL
{
    SUBSCRIPTION_ID (Number64)
    Reason       (Optional String)
}
</artwork>
<t>Field SUBSCRIPTION<em>ID MUST match the equivalent field in
the <tt>SUBSCRIBE</tt> message to which this reply applies.
The Reason is an optional string provided for application
consumption. <tt>SUBSCRIBE_CANCEL</tt> message implies canceling
of all the subscriptions for the given SUBSCRIPTION</em>ID.</t>
</section>

<section anchor="relay-redirect-message"><name>RELAY_REDIRECT Message</name>
<t><tt>RELAY_REDIRECT</tt> message enables relay failover scenarios
that is sent in response to <tt>PUBLISH</tt>, <tt>PUBLISH_INTENT</tt>
and <tt>SUBSCRIBE</tt> messages indicating the new relay
to the clients.</t>

<artwork>RELAY_REDIRECT
{
  RELAY_ADDRESS  (String)
}
</artwork>
</section>

<section anchor="fragmentation-and-reassembly"><name>Fragmentation and Reassembly</name>
<t>Application data may need to be fragmented to fit the underlying transport
packet size requirements. QuicR protocol is responsbile for performing necessary
fragmentation and reassembly. Each fragment needs to be small enough to
send in a single QUIC packet. The low order bit is also a Last
Fragment Flag to know the number of Fragments. The upper bits are used
as a fragment counter with the first fragment starting at 1.
The <tt>FRAGMENT_ID</tt> with in the <tt>PUBLISH</tt> message identifies the individual
fragments.</t>
</section>
</section>

<section anchor="relay_behavior"><name>Relay Function and Relays</name>
<t>Clients may be configured to connect to a local relay which then does a
Publish/Subscribe for the appropriate named data towards the origin  or
towards another Relay. These relays can aggregate the subscriptions from
multiple clients. This allows a relay in the LAN to aggregate request from
multiple clients in subscription to the same data such that only one copy of
the data flows across the WAN. In the case where there is only one client,
this may still provides benefit in that a client that is experiencing loss
on WIFI WAN has a very short RTT to the local relay so can recover the lost
data much faster, and with less impact on end user QoE, than having to go
across the LAN to recover the data.</t>
<t>Relays can also be deployed in classic CDN cache style for large scale
streaming applications yet still provide much lower latency than traditional
CDNs using Dash or HLS. Moving these relays into the 5G network close to
clients may provide additional increase in QoE.</t>
<t>At a high level, Relay Function within QuicR architecture support store and
forward behavior. Relay function can be realized in any component of the
QuicR architecture depending on the application. Typical use-cases might
require the intermediate servers (caches) and the origin server to implement
the relay function. However the endpoint themselves can implement the Relay
function in a Isomorphic deployment, if needed.</t>
<t>Non normatively, the Relay function is responsible carryout the following
actions to enable the QuicR protocol:</t>

<ol>
<li><t>On reception of <tt>SUBSCRIBE</tt> message, forward the message to the
Origin server, and on the receipt of  <tt>SUBSCRIBE_REPLY</tt>, store the
subscriber info against the names in the NAMES_SUCCESS field of the
<tt>SUBSCRIBE_REPLY</tt> message. If an entry for the name exists already, add the
new subscriber to the list of Subscibers. [ See Subscribe Aggregations].</t>
</li>
<li><t>If there exists a matching named object for a subscription in the cache,
forward the data to the subscriber(s) based on the subscribe INTENT.</t>
</li>
<li><t>On reception of <tt>PUBLISH_INTENT</tt> message, forward the
message to the Origin server, and on the receipt of
<tt>PUBLISH_INTENT_OK</tt>, store the names as authorized against a
given publisher.</t>
</li>
<li><t>If a named object arrives at the relay via <tt>PUBLISH</tt> message ,
cache the name and the associated data, also distribute the same to
all the active subscribers, if any, matching the given name.</t>
</li>
</ol>
<t>The payload associated with a given <tt>PUBLISH</tt> message MUST not be
cached longer than the <strong>BESTBEFORE</strong> time specified. Also to note, the
local policies dicatated by the caching service provider can always
overwrite the caching duration for the published data.</t>
<t>Relays MUST NOT modify the either the <tt>Name</tt> or the contents of
<tt>PUBLISH/SUBSCRIBE</tt> messags expect for performing the necessary
forwarding and caching operations as described above.</t>

<section anchor="relay-fail-over"><name>Relay fail over</name>
<t>A relay that wants to shutdown and use the redirect message to move traffic
to a new relay. If a relay has failed and restarted or been load balanced
to a different relay, the client will need to resubscribe to the new relay
after setting up the connection.</t>
<t>TODO: Cluster so high reliable relays should share subscription info and
publication to minimize of loss of data during a full over.</t>
</section>

<section anchor="relay-discovery"><name>Relay Discovery</name>
<t>Local relays can be discovered via MDNS query to TODO. Cloud relays
are discovered via application defined ways that is out of scope
of this document. A Relay can send a message to client with the
address of new relay. Client moves to the new relay with all of its
Subscriptions and then Client unsubscribes from old relay and closes
connection to it.</t>
<t>This allows for make before break transfer from one relay to another
so that no data is lost during transition. One of the uses of this
is upgrade of the Relay software during operation.</t>
</section>
</section>

<section anchor="quicr-manifest"><name>QuicR Manifest</name>
<t>Names can be optionally discovered via manifests. In such cases, the
role of the manifest is to identify the names as well as aspects
pertaining to the associated data in a given usage context of the
application.</t>

<ul>
<li><t>Typically a manifest identifies the domain and application aspects for
the set of names that can be published.</t>
</li>
<li><t>The content of Manifest is application defined and end-to-end
encrypted.</t>
</li>
<li><t>The manifest is owned by the application's origin server and are
accessed as a protected resources by the authorized QuicR clients.</t>
</li>
<li><t>The QuicR protocol treats Manifests as a named object, thus allowing
for clients to subscribe for the purposes of bootstrapping into the
session as well as to follow manifest changes during a session
[ new members joining a conference for example].</t>
</li>
<li><t>The manifest has well known name on the Origin server.</t>
</li>
</ul>
<t>Also to note, a given application might provide non QuicR mechanisms to
retrieve the manifest.</t>
<t>Below is a sample manifest for streaming application where a media
presentation server describes media streams available for
distribution. For downstream distribution of media data to clients
with varying requirements, the central server (along with the source)
generate different quality media representations. Each such quality is
represented with a unique name and subscribers are made know of
the same via the Manifest.</t>

<artwork>{
  &quot;liveSessionID&quot; : &quot;jon.doe.music.live.tv&quot;,
  &quot;streams: [
      {    
      &quot;id&quot;: &quot;1234&quot;,
      &quot;codec&quot;: &quot;av1&quot;,
      &quot;quality&quot;: &quot;1280x720_30fps&quot;,
      &quot;bitrate&quot;: &quot;1200kbps&quot;,
      &quot;crypto&quot;: &quot;aes128-gcm&quot;,
      },
      {    
      &quot;id&quot;: &quot;5678&quot;,
      &quot;codec&quot;: &quot;av1&quot;,
      &quot;quality&quot;: &quot;3840x2160_30fps&quot;,
      &quot;bitrate&quot;: &quot;4000kbps&quot;,
      &quot;crypto&quot;: &quot;aes256-gcm&quot;,
      },
      {    
      &quot;id&quot;: &quot;9999&quot;,
      &quot;codec&quot;: &quot;av1&quot;,
      &quot;quality&quot;: &quot;640x480_30fps&quot;,
      &quot;crypto&quot;: &quot;aes128-gcm&quot;,
      },
  ]
}

</artwork>
<t>Given the above manifest, a subscriber who is interested in 4K stream
shall subscribe to the name</t>
<t><tt>quicr://jon.doe.music.live.tv/video/5678/*</tt></t>
</section>

<section anchor="quic-mapping"><name>QUIC Mapping</name>

<section anchor="streams-vs-datagrams"><name>Streams vs Datagrams</name>
<t>Publishers of the named-data can specify the reliability gaurantees that is
expected from the QUIC transport. Setting of <tt>IS_RELIABLE</tt> flag to true
enables sending the application data as QUIC streams, otherwise as QUIC Datagrams.</t>
<t><tt>SUBSCRIBE</tt> for manifest always happens over QUIC Stream. Each new
<tt>SUBSCRIBE</tt> will be sent on a new QUIC Stream.</t>
<t><tt>PUBLISH</tt> messages per name are sent over their own QUIC Stream or as
QUIC DATAGRAM based on <tt>IS_RELILABLE</tt> setting. When using QUIC
streams, all the objects belonging to a group are sent on
the same QUIC Stream, whereas, different groups are sent in their
own QUIC Streams.</t>
</section>
</section>

<section anchor="quicr-usages"><name>QuicR Usages</name>

<section anchor="real-time-conferencing-application"><name>Real-time Conferencing Application</name>
<t>This subsection expands on using QuicR as the media delivery protocol for a
real-time multiparty A/V conferencing applications.</t>

<section anchor="naming"><name>Naming</name>
<t>Below provides one possible way to subdivide the application
component portion for a conferencing scenario.</t>

<ul>
<li><t>MeetingID: A identifier for the context of a single group session. Is unique
with in scope of Origin.</t>
</li>
<li><t>SenderID: Identifies a single endpoint client within the MeetingID that
publishes data.</t>
</li>
<li><t>SourceID: Identifies a stream of media or content from that Sender.
Example: A client that was sending media from a camera, a mic, and
screen share might use a different sourceID for each one. A scalable
codec with multiple layers or simulcast streams each would use a
different sourceID for each quality representation.</t>
</li>
<li><t>QualityID: Identifies media quality level - hi/low/medium</t>
</li>
</ul>
<t>For A/V conference, the encoded media frames are formed into
group of objects, where each group defines an independent
decodeable object set. In case of video, each group
comprises of objects on I-Frame boundaries, for audio a group
would map to an encoded audio sample for codecs used today.</t>
<t>A conforming name is formatted as URLs like:</t>
<t><tt>quicr://domain:port/MeetingID/SenderID/SourceID/QualityID/Group/Object</tt></t>
</section>

<section anchor="manifest"><name>Manifest</name>
<t>As a prerequisite step, participants exchange their transmit and
receive capabilities like sources, qualities, media types and so on,
with application server (can be origin server). This is done
out-of-band and is not in the scope of QuicR protocol.</t>
<t>However, as a outcome of this step is generation of the manifest data
that describes the names, qualities and other information that aid in
carrying out media delivery with QuicR protocol. This would for example
setup unique SourceID sub-part of the application component for each media
source or quality layers or a combination thereof. Similarly the SenderID
may get mapped from a roster equivalent for the meeting.</t>
<t>A manifest may get updated several times during a session - either due to
capabilities updates from existing participants or new participants joinings
or so on.</t>
<t>Participants who wish to receive media from a given meeting in a web conference
will do so by subscribing to the meeting's manifest. The manifest will list
the name of the active publishers.</t>
</section>

<section anchor="example"><name>Example</name>
<t>Below picture depicts a simplified QuicR Publish/Subscribe protocol flow
where participants exchange audio in a 3-party realtime audio conference.</t>

<sourcecode type="ascii-art">                           ┌──────────┐
                           │          │
                           ▼          │
                 ┌───────────────────┐│  sub:meeting123/*
                 │ acme.meetings.com ││
                 └─▲─────────────┬───┘│
                   │             │    │
                   │   pub:alice │    │
                   │     medi┌───▼─────────────┐
 pub:alice  ┌──────┘         │      Relay      │────┐
 ,meeting1  │                └┬────────────────┘    │
   23..     │                 │ sub:meeting123/*    │
            │        pub:alice│      ▲▲             │
            │          media  │┌─────┘└──────┐      │
            │                 ▼│             │      │
      ┌───────────┐       ┌────────┐    ┌─────────┐ │
      │   Alice   │       │  Bob   │    │  Carl   │ │   pub:alice
      └───────────┘       └────────┘    └─────────┘ │     media
                                             ▲      │
                                             │      │
                                             └──────┘%
</sourcecode>
<t>In the depicted protocol flow, Alice is the publisher while Bob and Carl
are the subscribers. As part of joining into the conference, Bob and Carl
subscribe to the name <tt>quicr://acme.meetings.com/meeting123/*</tt>  to receive
all the media streams being published for the meeting instance <tt>meeting123</tt>.
Their subscriptions are sent to Origin Server via a Relay.The Relay aggregates
the subscriptions from Bob and Carl, forwarding just one subscribe message. On
Alice publishing her media stream fragments from a camera source to the
Origin server, the same is forwarded to Relay. The relay will in turn forward
the same to Bob and Carl based on their subscriptions.</t>
<t>Here is another scenario, where Alice has 2 media sources (mic, camera) and
is able to send 2 simulcast streams for video (corresponding to 2
quality levels) and audio encoded via 2 different
codecs, might have different sourceIDs as listed below</t>

<artwork>Source       --&gt; SourceID
------------------------
mic_codec_1  --&gt; audio_opus
mic_codec_2  --&gt; audio_lyra
vid_simul_1  --&gt; video_hi
vid_simul_2  --&gt; video_low

Alice's SenderID -&gt; Alice and she is joining meeting with id 
meeting123

Names that Alice can publish includes:

quicr://acme.meetings.com/meeting123/Alice/audio_opus/...
quicr://acme.meetings.com/meeting123/Alice/audio_lyra/...
quicr://acme.meetings.com/meeting123/Alice/video_hi/...
quicr://acme.meetings.com/meeting123/Alice/video_low/...

</artwork>
<t>Manifest encoded as json objects might capture the information as below.</t>

<artwork>{
    &quot;origin&quot;: &quot;acme.meetings.com&quot;
    &quot;meeting&quot;: &quot;meeting123&quot;,
    publisher {
        id: &quot;Alice&quot;,
        source: [
            {
                &quot;type&quot; : &quot;audio&quot;,
                &quot;sourceId&quot;: &quot;alice-mic&quot;,
                &quot;streams&quot;: [
                    {
                        &quot;id&quot;: &quot;audio_opus,
                        &quot;codec&quot;: &quot;opus&quot;,
                        &quot;quality&quot;: &quot;48khz&quot;,
                    }, {
                        &quot;id&quot; : &quot;audio_lyra&quot;,
                        ....
                    }
                ]
            }, {
            &quot;type&quot;: &quot;video&quot;,
            &quot;sourceId&quot;: &quot;alice-cam&quot;,
            &quot;streams&quot;: [
                {
                    &quot;id&quot;: &quot;video_hi&quot;,
                    &quot;codec:&quot; : &quot;av1&quot;,
                    &quot;quality&quot; : &quot;1920x720_60fps&quot;
                },
                {
                    &quot;id&quot;: &quot;video_lo&quot;,
                    &quot;codec:&quot; : &quot;av1&quot;,
                    &quot;quality&quot; : &quot;640x480_30fps&quot;
                }
            ],
            },
        ]
    }
}

</artwork>
<t>With the names as above, any subscriber retrieving the manifest has the
necessary information to send <tt>SUBSCRIBE</tt> for the named data of interest.
The same happens when the manifest is updated once the session is in progress.</t>
<t>A sample subscribe for lyra audio and low-res video from Alice would
have the form:</t>
<t><tt>quicr://meetings.com/meeting123/alice/audio/alice-mic/audio_lyra/*</tt></t>
<t><tt>quicr://meetings.com/meeting123/alice/video/alice-cam/video_lo/*</tt></t>
</section>
</section>

<section anchor="push-to-talk-media-delivery-application"><name>Push To Talk Media Delivery Application</name>
<t>Frontline communications application like Push To Talk have close semblances
with the publish/subscribe metaphor. In a typical setup, say a retail store,
there are mutiple channels (bakery, garden) and retail workers with PTT
communication devices access the chatter over such channels by tuning into
them. In a typical use-case, the retails workers might want to tune into one
or more channels of their interest and expect the media delivery system to
deliver the media asynchornusly as talk spurts.</t>
<t>In general such a system needs the following:</t>

<ul>
<li>A way for the end users to tune to their channels of interest and have
these interests be longlived transactions.</li>
<li>A way for system to efficiently distribute the media to all the tuned in
end users per channel.</li>
<li>A way for end user to catch up and playback when switching the channels.</li>
</ul>

<section anchor="naming-1"><name>Naming</name>
<t>In the case of PTT, the following mappings can be one way to defined
the application subcomponents.</t>

<ul>
<li>StoreID   - Identifier for store at various locations.</li>
<li>ChannelID - Each PTT channel represents its own high level resource</li>
<li>SenderID  - Authenticated user's Id who is actively checkedin into a
frontline workplace (ex: a store).</li>
</ul>
<t>With above division of <tt>Application Component</tt>, a sample QuicR named
object might have following form</t>
<t><tt>quicr://wallmart.com/store22/ch3/alice/groupID/objectID</tt></t>
<t>In the above example, StoreID is store22, with ChannelID being channel 3
and the media corresponds to user, alice. The group of objects in this case
map to the QuicR audio objects for audio delivery.</t>
<t>A <tt>SUBSCRIBE</tt> for all the PTT messages sent over channel 3, could
be represented as</t>
<t><tt>quicr://wallmart.com/store22/ch3/*</tt></t>
<t>This will trigger the Relay Function to forward PTT audio from
everyone on channel-3 to sent to the subscriber, as is
typically expected in a frontline applications.</t>
</section>

<section anchor="manifest-1"><name>Manifest</name>
<t>For PTT application, a manifest describes various active PTT channels as
the main resource. Subsribers who tune into channels typically get the names
from the manifest to do so. Publishers publish their media to channels that
they are authorized to.</t>

<section anchor="example-1"><name>Example</name>
<t>An example retail store scenario where users Alice, Bob subscribe to the
bakery channel and Carl subscribes to the gardening channel. Also an
annoucement from the store manager Tom, on bakery channel gets
delivered to Alice and Bob but not Carl.</t>

<artwork>Alice: authorized to talk/listen on Channel Bakery
Bob:   authorized to talk/listen on Channel Bakery
Carl:  authorized to talk/listen on Channel GARDENING
Tom:   authorized to talk/listen on channels Bakery 
       and Gardening

Bakery Channel Id -&gt; bakery
Gardening Channel Id -&gt; gardening

</artwork>
<t>Manifest encoded as json objects might capture the information as below.
[This encoded is for information purposes only.]</t>

<artwork>{
    &quot;origin&quot;: &quot;walmart.com&quot;,
    &quot;storeId&quot;: &quot;store22
    &quot;channel&quot;: [
        {
            &quot;name&quot;: &quot;bakery&quot;,
            &quot;id&quot; : &quot;bakery&quot;,
            &quot;codec&quot;: &quot;opus&quot;,
            &quot;quality&quot;: &quot;48khz&quot;,  
            ....          
        },
        {
            &quot;name&quot;: &quot;gardening&quot;,
            &quot;id&quot; : &quot;gardening&quot;,
            &quot;codec&quot;: &quot;opus&quot;,
            &quot;quality&quot;: &quot;48khz&quot;,
            ...
        },
    ]
}

</artwork>
<t>Alice and Bob shall subscribe to channel Bakery
<tt>quicr://wamart.com/store22/bakery/*</tt>
and Carl subscribe to channel Gargdening
<tt>quicr://wamart.com/store22/gardening/*</tt>.</t>
</section>
</section>
</section>

<section anchor="low-latency-streaming-applications"><name>Low Latency Streaming Applications</name>
<t>A typical streaming application can be divided into 2 halves - media ingest
and media distribution. Media ingestion is done via pushing one or more
streams of different qualities to a central server. Media Distribution
downstream is customized (via quality/rate adapation) per consumer by
the central server.</t>
<t>One can model ingestion as sending <tt>PUBLISH</tt> mesages and the
associated sources as publishers. Similarly, the consumers/end
clients of the streaming media <tt>SUBSCRIBE</tt> to the media elements
whose names are defined in the manifest. Manifest describes the
name and qualities associated with media being published. The central
severs (Origin) themselves act as publisher for producing streams
with different qualities.</t>
<t>Streaming use-cases requiring lower latencies and high degree of
realtime interactivity (chat for example) can easilt fit into QuicR's media
delivery protocol.</t>
<t>Lower latencies can be achieved by the relay forwarding the data as
they arrive to the subscribed clients.</t>
<t>Few sample scenarios that have such constrainsts are listed below:</t>

<ul>
<li><t>Professional streamers (gamers/musicians) interacting with a
live audience on social media, often via a directly coupled chat
function in the viewing app/environment.  A high degree of
interactivity between the performer and the audience is required
to enable engagement.</t>
</li>
<li><t>Live Auctions are another category of applications where an
auction is broadcasted to serveral participants. The content must be
delivered with low latency and more importantly within a well-defined
sync across endpoints so customers trust the auction is fair.</t>
</li>
</ul>
<t>Visual and aural quality are secondary in priority in these scenarios to
sync and latency. This in turn increases revenue potential from a
game/event.</t>

<section anchor="naming-and-manifest-considerations"><name>Naming and Manifest Considerations</name>
<t>For downstream distribution of media data to clients with varying
requirements, the central server (along with the source) generate
different quality media representations. Each such quality is
represented with a unique name and subscribers are made know of
the same via the Manifest.</t>

<artwork>{
  &quot;resource&quot; : &quot;jon.doe.music.live.tv&quot;,
  &quot;streams: [
      {    
      &quot;id&quot;: &quot;1234&quot;,
      &quot;codec&quot;: &quot;av1&quot;,
      &quot;quality&quot;: &quot;1920x720_60fps&quot;
      },
      {    
      &quot;id&quot;: &quot;5678&quot;,
      &quot;codec&quot;: &quot;av1&quot;,
      &quot;quality&quot;: &quot;3840x2160_30fps&quot;
      },
      {    
      &quot;id&quot;: &quot;9999&quot;,
      &quot;codec&quot;: &quot;av1&quot;,
      &quot;quality&quot;: &quot;640x480_30fps&quot;
      },
  ]
}

</artwork>
<t>Consumers end points subscribe to one or more names representing the
quality based on their capabilities. This enables the relay to forward
the ingested data to be sent as they arrive to the subscribers.</t>
</section>
</section>
</section>

<section anchor="security"><name>Security</name>
<t>Security considerations defined in <tt>draft-jennings-moq-quicr-arch</tt> applies
here as well.</t>
</section>

<section anchor="todo"><name>TODO</name>

<ol>
<li>Define trust establishment flows between QuicR Endpoints,
Cloud Relays and the Origin Server. Also add security toke to
the messages.</li>
<li>Messages needs some security considerations - integrity
protection and so on.</li>
<li>Define constructs for End to End Encryption</li>
<li>Fix the notation of the messages</li>
</ol>
</section>

</middle>

<back>

<section anchor="acknowledgments"><name>Acknowledgments</name>
<t>Thanks to Nermeen Ismail, Mo Zanaty,  for contributions and suggestions to this
specification.</t>
</section>

</back>

</rfc>
