<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
  <!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
  <title>Jingle RTP Feedback Negotiation</title>
  <abstract>This specification defines an XMPP extension to negotiate
  the use of the Extended RTP Profile for Real-time Transport Control
  Protocol (RTCP)-Based Feedback (RTP/AVPF) with Jingle RTP
  sessions</abstract>
  &LEGALNOTICE;
  <number>0293</number>
  <status>Draft</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XEP-0167</spec>
    <spec>RFC 4585</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>NOT_YET_ASSIGNED</shortname>
  <schemaloc>
    <url>http://xmpp.org/schemas/jingle-apps-rtp-rtcp-fb.xsd</url>
  </schemaloc>
  <discuss>jingle</discuss>
  <author>
    <firstname>Olivier</firstname>
    <surname>CrĂȘte</surname>
    <email>olivier.crete@collabora.co.uk</email>
    <jid>olivier.crete@collabora.co.uk</jid>
  </author>
  <revision>
    <version>1.0</version>
    <date>2015-08-11</date>
    <initials>XEP Editor (mam)</initials>
    <remark><p>Advanced to Draft per a vote of the XMPP Council.</p></remark>
  </revision>
  <revision>
    <version>0.3</version>
    <date>2015-04-29</date>
    <initials>ph</initials>
    <remark><p>Address council LC feedback.</p></remark>
  </revision>
  <revision>
    <version>0.2</version>
    <date>2015-03-25</date>
    <initials>ph</initials>
    <remark><p>Added XML Schema; Updated based on last-call feedback.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2011-03-24</date>
    <initials>psa</initials>
    <remark><p>Initial published version.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2011-01-10</date>
    <initials>oc</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>

<section1 topic='Introduction' anchor='introduction'>
  <p>This documents specifies how to negotiate the use of the Extended
  RTP Profile for Real-time Transport Control Protocol (RTCP)-Based
  Feedback (RTP/AVPF) with Jingle RTP sessions.</p>
</section1>

<section1 topic='Requirements' anchor='requirements'>
  <p>The Jingle extension defined herein is designed to meet the following requirements:</p>
  <ol>
    <li>Enable negotiations of the required parameters for the
    transmissions of RTP Feedback messages as defined in &rfc4585;.</li>
    <li>Map these parameters to Session Description Protocol (SDP; see
    &rfc4566;) to enable interoperability.</li>
  </ol>
</section1>

<section1 topic='New elements' anchor='elements'>
  <p>This specification defines two new elements, &lt;rtcp-fb/&gt; and
  &lt;rtcp-fb-trr-int/&gt;, that can be inserted in the
  &lt;description/&gt; or the &lt;payload-type/&gt; elements of
  &xep0167;. The presence of any of these elements in a
  content's description means that the RTP/AVPF profile should be used
  for the whole content.  If any of these elements are inside the
  &lt;payload-type/&gt; element, the parameters specified apply only to
  that payload type, if they are directly inside the
  &lt;description/&gt; tag, then the specified parameters apply to the
  whole content.</p>

<p>The attributes of the &lt;rtcp-fb/&gt; element are:</p>
<table caption='rtcp-fb attributes'>
  <tr>
    <th>Attribute</th>
    <th>Description</th>
    <th>Inclusion</th>
    <th>Possible values</th>
  </tr>
  <tr>
    <td>type</td>
    <td>The type of feedback</td>
    <td>REQUIRED</td>
    <td>ack, nack, ccm, app, etc..</td>
  </tr>
  <tr>
    <td>subtype</td>
    <td>The subtype (depends on the type)</td>
    <td>OPTIONAL (possibly REQUIRED depending on the type)</td>
    <td>
      ack: rpsi, app;
      nack: sli, pli, rpsi, app, rai;
      ccm: fir, tmmbr, tstr, vbcm;
      app: depends on the application;
    </td>
  </tr>
</table>

<p>Any type or subtype of feedback message that requires extra
parameters in the a=b form can use the &lt;parameter/&gt; element to
describe it. Any other form of parameter can be stored as the 'key' attribute in a parameter element with an empty value.</p>
<p>Note: this overlaps with the subtype attribute. If there is only one parameter, use the subtype. The only known example where this is required is ccm.</p>

<p>The element &lt;rtcp-fb-trr-int/&gt; is used to specify the minimum
interval between two Regular (full compound) RTCP packets in
milliseconds for this media session. It corresponds to the
"a=rtcp-fb:* trr-int" line in SDP. The attributes of the
&lt;rtcp-fb-trr-int/&gt; element are:</p>
<table caption='rtcp-fb-trr-int attributes'>
  <tr>
    <th>Attribute</th>
    <th>Description</th>
    <th>Inclusion</th>
    <th>Possible values</th>
  </tr>
  <tr>
    <td>value</td>
    <td>Number of milliseconds between regular RTCP reports</td>
    <td>REQUIRED</td>
    <td>0 to MAXUINT (default to 0)</td>
  </tr>
</table>
</section1>



<section1 topic='Negotiation' anchor='negotiation'>
  <p>Feedback messages are negotiated along side the codecs. They follow
  the same Offer/Answer mechanism based on SDP Offer/Answer. The
  initiator signals which feedback messages it wants to send or
  receive in the the &lt;session-initiate/&gt; iq stanza. If the
  responder does not understand the type or subtype of a feedback
  message, it MUST remove the element from the reply. If the responder
  does not wish to provide or receive some kind of feedback, it MUST
  remove the relevant element. It MUST then send the remaining
  elements it wants to keep as-is without modifying them in the
  &lt;session-accept/&gt;</p>

  <p>To conform with the negotiation rules outlined in <cite>RFC 4585</cite> Section 4,
  the responder MUST send any &lt;rtcp-fb/&gt; element as-is if it
  accepts it. It MUST NOT change any parameter. It MUST NOT add any
  &lt;rtcp-fb/&gt; element that was not offered by the initiator. It
  MUST NOT modify the 'value' of any &lt;rtcp-fb-trr-int/&gt;
  element. It can only remove the &lt;rtcp-fb-trr-int/&gt; element or
  reject the content. If all the feedback messages are removed but the
  responder wants to stay in the RTP/AVPF profile, it MUST put a
  &lt;rtcp-fb-trr-int/&gt; element with the same 'value' that it
  received from the intiator, if the initiator did not provide a
  &lt;rtcp-fb-trr-int/&gt; element, then this value is "0".</p>

  <p>Example negotiation where the initiator requests Packet Loss
  Indications (pli) as defined in <cite>RFC 4585</cite> on both H.263 and H.264,
  but also requests Slice Loss Indications for H.264 with a minimum
  interval between regular full compound RTCP packets of 100 milliseconds.</p>

  <example caption='Initiator sends description inside session-initiate'><![CDATA[
<description xmlns='urn:xmpp:jingle:apps:rtp:1' media='video'>
  <rtcp-fb xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' type='nack' subtype='pli'/>
  <payload-type id='96' name='H264' clockrate='90000'>
    <rtcp-fb-trr-int xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' value='100'/>
    <rtcp-fb xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' type='nack' subtype='sli'/>
  </payload-type>
  <payload-type id='34' name='H263' clockrate='90000'/>
</description>
]]></example>

  <p>Example reply where the responder rejects the "sli" but
  accepts the "pli".</p>

 <example caption='Responder sends description inside session-accept'><![CDATA[
<description xmlns='urn:xmpp:jingle:apps:rtp:1' media='video'>
  <rtcp-fb xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' type='nack' subtype='pli'/>
  <payload-type id='96' name='H264' clockrate='90000'>
    <rtcp-fb-trr-int xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' value='100'/>
  </payload-type>
  <payload-type id='34' name='H263' clockrate='90000'/>
</description>
]]></example>

 <p>Another reply to the same request where the responder wishes to
 stay in the AVPF profile but rejects all specific feedback messages
 by using the &lt;rtcp-fb-trr-int/&gt; with the default value.</p>

<example caption='Responder sends description inside session-accept without any feedback message'><![CDATA[
<description xmlns='urn:xmpp:jingle:apps:rtp:1' media='video'>
  <rtcp-fb-trr-int xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' value='0'/>
  <payload-type id='96' name='H264' clockrate='90000'/>
  <payload-type id='34' name='H263' clockrate='90000'/>
</description>
]]></example>
</section1>

<section1 topic='Mapping to Session Description Protocol' anchor='sdp-mapping'>
  <p>The &lt;rtcp-fb/&gt; element maps to the a:rtcp-fb= SDP line with
  the exception of the 'trr-int' parameter which is mapped into it's
  own element (&lt;rtcp-fb-trr-int/&gt;) in XMPP. The payload types
  are also not explicitly written in the &lt;rtcp-fb/&gt; and
  &lt;rtcp-fb-trr-int/&gt; elements. Instead, each payload type has its own
  set of &lt;rtcp-fb/&gt; and &lt;rtcp-fb-trr-int/&gt; elements if
  they do not apply to the whole content.</p>

  <p>Example conversion of a sample fragment of a SDP containing an
  audio session using the RTP/AVP profile for audio and the RTP/AVPF
  profile for video:</p>
<example caption='SDP fragment'><![CDATA[
 v=0
 o=remeo 3203093520 3203093520 IN IP4 host.example.com
 s=Video call with feedback
 t=3203130148 3203137348
 m=audio 49170 RTP/AVP 0
 c=IN IP4 10.0.1.1
 a=rtpmap:0 PCMU/8000
 m=video 59172 RTP/AVPF 98 99
 c=IN IP4 10.0.1.1
 a=rtpmap:98 H263-1998/90000
 a=rtpmap:99 H261/90000
 a=rtcp-fb:* nack
 a=rtcp-fb:98 nack rpsi
 a=rtcp-fb:98 trr-int 100
]]></example>
<example caption='The same description in XMPP format'><![CDATA[
<iq from='romeo@montague.lit/orchard'
    id='ph37a419'
    to='juliet@capulet.lit/balcony'
    type='set'>
  <jingle xmlns='urn:xmpp:jingle:1'>
    action='session-initiate'
    initiator='romeo@montague.lit/orchard'
    sid='a73sjjvkla37jfea'>
    <content creator='initiator' name='voice'>
      <description xmlns='urn:xmpp:jingle:apps:rtp:1' media='audio'>
        <payload-type id='0' name='PCMU' />
      </description>
      <transport xmlns='urn:xmpp:jingle:transports:raw-udp:1'>
        <candidate component='1'
	     generation='0'
	     id='a9j3mnbtu1'
	     ip='10.0.1.1'
	     port='49170'/>
        <candidate component='2'
 	     generation='0'
	     id='a9j3mnbtu1'
	     ip='10.0.1.1'
	     port='49171'/>
      </transport>
    </content>
    <content creator='initiator' name='face'>
      <description xmlns='urn:xmpp:jingle:apps:rtp:1' media='video'>
        <rtcp-fb xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' type='nack'/>
        <payload-type id='98' name='H263-1998'>
          <rtcp-fb xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' type='nack'
                   subtype='rpsi'/>
          <rtcp-fb-trr-int xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0' value='100'/>
        </payload-type>
        <payload-type id='99' name='H264' />
      </description>
      <transport xmlns='urn:xmpp:jingle:transports:raw-udp:1'>
        <candidate component='1'
                   generation='0'
                   id='a9j3mnbtu1'
                   ip='10.0.1.1'
                   port='49172'/>
        <candidate component='2'
                   generation='0'
                   id='a9j3mnbtu1'
                   ip='10.0.1.1'
                   port='49173'/>
      </transport>
    </content>
  </jingle>
</iq>

]]></example>
</section1>

<section1 topic='Determining support' anchor='determining-support'>
  <p>To advertise its support for Extended RTCP Feedback in Jingle RTP
  Sessions and a minimum interval between regular RTCP packets, when
  replying to &xep0030; information requests an entity MUST return the
  following features:</p>

  <ol>
     <li>URNs for any version of this protocol that the entity
     supports -- e.g., "urn:xmpp:jingle:apps:rtp:rtcp-fb:0" for the
     current version</li>
  </ol>

  <p>An example follows:</p>

  <example caption="Service discovery information request"><![CDATA[
    <iq from='romeo@montague.lit/orchard'
	id='bh3vd715'
	to='juliet@capulet.lit/balcony'
	type='get'>
      <query xmlns='http://jabber.org/protocol/disco#info'/>
    </iq>
]]></example>

  <example caption="Service discovery information response"><![CDATA[
    <iq from='juliet@capulet.lit/balcony'
	id='bh3vd715'
	to='romeo@montague.lit/orchard'
	type='result'>
      <query xmlns='http://jabber.org/protocol/disco#info'>
	<feature var='urn:xmpp:jingle:1'/>
	<feature var='urn:xmpp:jingle:apps:rtp:1'/>
	<feature var='urn:xmpp:jingle:apps:rtp:video'/>
	<feature var='urn:xmpp:jingle:apps:rtp:rtcp-fb:0'/>
      </query>
    </iq>
]]></example>
</section1>

<section1 topic='IANA Considerations' anchor='iana-considerations'>
  <p>This document requires no interaction with the Internet Assigned
  Numbers Authority (IANA).</p>
</section1>

<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
    <p>This specification defines the following XML namespaces:</p>
    <ul>
      <li>urn:xmpp:jingle:apps:rtp:rtcp-fb:0</li>
    </ul>
    <p>The &REGISTRAR; includes the foregoing namespaces in its
    registry at &NAMESPACES;, as governed by &xep0053;.</p>
  </section2>
  <section2 topic='Namespace Versioning' anchor='registrar-versioning'>
    &NSVER;
  </section2>
</section1>
<section1 topic='XML Schemas'>
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:jingle:apps:rtp:rtcp-fb:0'
    xmlns='urn:xmpp:jingle:apps:rtp:rtcp-fb:0'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0293: http://www.xmpp.org/extensions/xep-0293.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='rtcp-fb'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='parameter'
            type='parameterElementType'
            minOccurs='0'
            maxOccurs='unbounded'/>
      </xs:sequence>
      <xs:attribute name='type' type='xs:string' use='required'/>
      <xs:attribute name='subtype' type='xs:string' use='optional'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='rtcp-fb-trr-int'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='empty'>
          <xs:attribute name='value' type='xs:positiveInteger' use='required'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:complexType name='parameterElementType'>
    <xs:simpleContent>
      <xs:extension base='empty'>
        <xs:attribute name='name' type='xs:string' use='required'/>
        <xs:attribute name='value' type='xs:string' use='optional'/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

</xs:schema>
]]></code>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
  <p>Thanks to Youness Alaoui for his feedback.</p>
</section1>

</xep>