<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc compact="yes"?>
<?rfc subcompact="yes"?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes"?>
<?rfc symrefs="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>

<rfc category="std" docName="draft-ietf-avtext-framemarking-02" ipr="trust200902">

  <front>
    <title abbrev="Frame Marking">Frame Marking RTP Header Extension</title>

    <author initials="E." surname="Berger" fullname="Espen Berger">
      <organization>Cisco Systems</organization>
      <address>
        <phone>+47 98228179</phone>
        <email>espeberg@cisco.com</email>
      </address>
    </author>

    <author fullname="Suhas Nandakumar" initials="S" surname="Nandakumar">
      <organization>Cisco Systems</organization>
      <address>
        <postal>
          <street>170 West Tasman Drive</street>
          <city>San Jose</city>
          <region>CA</region>
          <code>95134</code>
          <country>US</country>
        </postal>
        <email>snandaku@cisco.com</email>
      </address>
    </author>

	<author fullname="Mo Zanaty" initials="M" surname="Zanaty">
      <organization>Cisco Systems</organization>
      <address>
        <postal>
          <street>170 West Tasman Drive</street>
          <city>San Jose</city>
          <region>CA</region>
          <code>95134</code>
          <country>US</country>
        </postal>
        <email>mzanaty@cisco.com</email>
      </address>
    </author>

    <date month="July" year="2016"/>

    <area>Applications</area>
    <keyword>Internet-Draft</keyword>

    <abstract>
      <t>This document describes a Frame Marking RTP header extension used to
      convey information about video frames that is critical for error recovery
      and packet forwarding in RTP middleboxes or network nodes. It is most
      useful when media is encrypted, and essential when the middlebox or node
      has no access to the media encryption keys. It is also useful for
      codec-agnostic processing of encrypted or unencrypted media, while it also
      supports extensions for codec-specific information.</t>
    </abstract>
  </front>

  <middle>

    <section title="Introduction" anchor="intro">
      <t>Many widely deployed RTP <xref target="RFC3550" /> topologies used in modern voice and video
      conferencing systems include a centralized component that acts as an RTP switch.
      It receives voice and video streams from each participant, which may be encrypted using
      SRTP <xref target="RFC3711" />, or extensions that provide participants with
      private media via end-to-end encryption that excludes the switch.
      The goal is to provide a set of streams back to
      the participants which enable them to render the right media content. In a 
      simple video configuration, for example, the goal will be that each participant 
      sees and hears just the active speaker. In that case, the goal of the switch is to 
      receive the voice and video streams from each participant, determine the active 
      speaker based on energy in the voice packets, possibly using the client-to-mixer
      audio level RTP header extension, and select the corresponding video
        stream for transmission to participants; see <xref target="rtpswitch" />.</t>

      <t>In this document, an "RTP switch" is used as a common short term for the terms 
      "switching RTP mixer", "source projecting middlebox",
      "source forwarding unit/middlebox" and "video switching MCU" as
      discussed in <xref target="I-D.ietf-avtcore-rtp-topologies-update" />.</t>

      <figure title="RTP switch" anchor="rtpswitch"><artwork><![CDATA[
         +---+      +------------+      +---+
         | A |<---->|            |<---->| B |
         +---+      |            |      +---+
                    |   RTP      |
         +---+      |  Switch    |      +---+
         | C |<---->|            |<---->| D |
         +---+      +------------+      +---+
]]>
    </artwork></figure>

    <t>In order to properly support switching of video streams, the RTP switch typically needs 
    some critical information about video frames in order to start and stop forwarding streams.
      <list style="symbols">
        <t>Because of inter-frame dependencies, it should ideally switch video streams at a point 
        where the first frame from the new speaker can be decoded by recipients without prior 
        frames, e.g switch on an intra-frame.  </t>
        <t>In many cases, the switch may need to drop frames in order to realize congestion control 
        techniques, and needs to know which frames can be dropped with minimal impact to video quality.</t>
        <t>Furthermore, it is highly desirable to do this in a way which is not specific to the 
        video codec. Nearly all modern video codecs share common concepts around frame types.</t>
        <t>It is also desirable to be able to do this for SRTP without requiring the video switch to 
        decrypt the packets. SRTP will encrypt the RTP payload format contents and consequently this 
        data is not usable for the switching function without decryption, which may not even
        be possible in the case of end-to-end encryption of private media.</t>
      </list>
     </t>
     <t>
      A comprehensive discussion of SFU considerations around codec agnostic selective forwarding of
      RTP media is described in <xref target="I-D.aboba-avtcore-sfu-rtp"/>
     </t> 

      <t>By providing meta-information about the RTP streams outside the encrypted media payload an
      RTP switch can do selective forwarding without decrypting the payload. This document provides a 
      solution to this problem.</t>
    </section>
    <section title="Key Words for Normative Requirements">
      <t>
        The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;,
        &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and
        &quot;OPTIONAL&quot; in this document are to be interpreted as described in
        <xref target="RFC2119" />.
      </t>
    </section>

    <section title="Frame Marking RTP Header Extension">
      <t>The solution uses RTP header extensions as defined in <xref target="RFC5285" />. A subset of 
      meta-information from the video stream is provided as an RTP header extension to allow an RTP switch
      to do generic selective forwarding of video streams encoded with potentially different video codecs.</t>

      <section title="Mandatory Extension" anchor="mandatory">
      	<t>The following information are extracted from the media payload and sent in the Frame Marking RTP header extension.
         	<list style='symbols'>
            <t>S: Start of Frame (1 bit) - MUST be 1 in the first packet in a frame
                within a layer; otherwise MUST be 0.</t>
            <t>E: End of Frame (1 bit) - MUST be 1 in the last packet in a frame
                within a layer; otherwise MUST be 0. </t>
            <t>I: Independent Frame  (1 bit) - MUST be 1 for frames that can be
               decoded independent of prior frames, e.g. intra-frame, VPx keyframe,
               H.264 IDR <xref target="RFC6184" />, H.265 CRA/BLA; otherwise MUST be 0.</t>
            <t>D: Discardable Frame (1 bit) - MUST be 1 for frames that can be dropped,
                and still provide a decodable media stream; otherwise MUST be 0. </t>
            <t>B: Base Layer Sync (1 bit) - MUST be 1 if this frame only depends
                on the base layer; otherwise MUST be 0.</t>
            <t>TID: Temporal ID (3 bits) - The base temporal layer starts with 0, and increases
          		with 1 for each higher temporal layer/sub-layer. </t>
          	<t>LID: Layer ID (8 bits) - Identifies the spatial and quality layer encoded.</t>
            <t>TL0PICIDX: Temporal Layer 0 Picture Index (8 bits) - Running index of base temporal layer 0 frames when TID is 0. When TID is not 0, this indicates a dependency on the given index.</t>
         	</list>
      	</t>
      	
      	<t>The layer information contained in TID and LID convey useful aspects of the layer structure that
          can be utilized in selective forwarding. Without further information about the layer structure,
          these identifiers can only be used for relative priority of layers.
          They convey a layer hierarchy with TID=0 and LID=0 identifying the base layer.
          Higher values of TID identify higher temporal layers with higher frame rates.
          Higher values of LID identify higher spatial or quality layers with higher resolutions and bitrates.
          </t><t>
          With further information,
          for example, possible future RTCP SDES items that convey full layer structure information, it may
          be possible to map these TIDs and LIDs to specific frame rates, resolutions and bitrates.
          Such additional layer information may be useful to forwarding decisions in the RTP switch,
          but is beyond the scope of this memo. The relative layer information is still useful
          for many selective forwarding decisions even without such additional layer information.
        </t>
      	
      	<t>The Frame Marking RTP header extension is encoded
      	using the one-byte header or two-byte header as described in <xref target="RFC5285" />.
        The one-byte header format is shown below and used for examples in this memo.
        The two-byte header format is used when other two-byte header extensions
        are present in the same RTP packet, since mixing one-byte and two-byte extensions
        is not possible in the same RTP packet.</t>
      	<figure>
          <artwork><![CDATA[
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ID=2 |  L=2  |S|E|I|D|B| TID |   LID         |    TL0PICIDX  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


]]></artwork></figure>

  	</section>
  	<section title="Layer ID Mappings">
      <section title="H265 LID Mapping">
    	 <t> The following shows H265-LayerID (6 bits) mapped to the 
    	 generic LID field.</t>
      <figure>
          <artwork><![CDATA[
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ID=2 |  L=2  |S|E|I|D|B| TID |0|0|  LayerID  |    TL0PICIDX  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork></figure>

    </section>
    <section title="VP9 LID Mapping">
	 <t> The following  shows VP9 Layer encoding information (4 bits for
	 spatial and quality) mapped to the generic LID field.</t>
      <figure>
          <artwork><![CDATA[
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ID=2 |  L=2  |S|E|I|D|B| TID |0|0|0|0| RS| RQ|    TL0PICIDX  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork></figure>
    </section>
    <section title="VP8 LID Mapping">
   <t> The following  shows the header extension for VP8 that contains
    no layer information.</t>
      <figure>
          <artwork><![CDATA[
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ID=2 |  L=2  |S|E|I|D|B| TID |0|0|0|0|0|0|0|0|    TL0PICIDX  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork></figure>
    </section>
    <section title="H264-SVC LID Mapping">
   <t> The following shows H264-SVC Layer encoding information (3 bits for
   spatial and 4 bits quality) mapped to the generic LID field.</t>
      <figure>
          <artwork><![CDATA[
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ID=2 |  L=2  |S|E|I|D|B| TID |0| DID |  QID  |    TL0PICIDX  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork></figure>
    </section>
    <section title="H264 (AVC) LID Mapping">
   <t> The following  shows the header extension for H264 (AVC) that contains
    no layer information.</t>
      <figure>
          <artwork><![CDATA[
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ID=2 |  L=2  |S|E|I|D|B| TID |0|0|0|0|0|0|0|0|    TL0PICIDX  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork></figure>
    </section>
  </section>
      
    <section title="Signaling information">
      <t>The URI for declaring this header extension in an extmap attribute is 
      "urn:ietf:params:rtp-hdrext:framemarking". It does not contain any
      extension attributes. </t>
      <t>An example attribute line in SDP:</t>
      <figure>
          <artwork><![CDATA[
   a=extmap:3 urn:ietf:params:rtp-hdrext:framemarking
]]></artwork></figure>

    </section>

    <section title="Considerations on use">
      <t>The header extension values MUST represent what is already in the RTP payload.</t>
      <t> When a RTP switch needs to discard a received video frame due to congestion control considerations, 
      it is RECOMMENDED that it preferably drop frames marked with the "discardable" bit.</t>
      <t> When a RTP switch wants to forward a new video stream to a receiver, it is RECOMMENDED to
      select the new video stream from the first switching point (I bit set) and forward the same.
      A RTP switch can request a media source to generate a switching point for H.264 by sending
      Full Intra Request (RTCP FIR) as defined in <xref target="RFC5104" />, for example. </t>
    </section>
  </section>

    <section title="Security Considerations"  >
      <t>In the Secure Real-Time Transport Protocol (SRTP) <xref target="RFC3711" />, RTP  header extensions are 
      authenticated but not encrypted. When header extensions are used  some of the payload type information are 
      exposed and is visible to middle boxes. The encrypted media data is not exposed, so this is not seen as a 
      high risk exposure. </t>
    </section>

	<section title="Acknowledgements">
      <t>Many thanks to Bernard Aboba, Jonathan Lennox, and Stephan Wenger for their inputs.</t>
    </section>

    <section title="IANA Considerations">
      <t>This document defines a new extension URI to the RTP Compact HeaderExtensions sub-registry of the 
      	Real-Time Transport Protocol (RTP) Parameters registry, according to the following data:</t>
   <t>Extension URI:  urn:ietf:params:rtp-hdrext:framemarkinginfo<vspace />
   Description: Frame marking information for video streams<vspace />
   Contact: espeberg@cisco.com<vspace />
   Reference: RFC XXXX</t>

   <t>Note to RFC Editor: please replace RFC XXXX with the number of this
   RFC.</t>
    </section>

  </middle>

  <back>

    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>
    </references>
    <references title="Informative References">
    <?rfc include='reference.I-D.ietf-avtcore-rtp-topologies-update'?>
    <?rfc include='reference.I-D.aboba-avtcore-sfu-rtp'?>
    <?rfc include="reference.RFC.3550"?>
    <?rfc include="reference.RFC.3711"?>
    <?rfc include="reference.RFC.5104"?>
    <?rfc include="reference.RFC.5285"?>
    <?rfc include="reference.RFC.6184"?>
    </references>
  </back>
</rfc>
