\section{Use of SDP for  RTSP Session Descriptions}
\label{sec:sdpusage}

The Session Description Protocol (SDP, RFC 2327 \cite{rfc2327}) may be
used to describe streams or presentations in RTSP.  Such usage is
limited to specifying means of access and encoding(s) for:

\begin{description}
\item[aggregate control:] A presentation composed of streams from one
or more servers that are available for aggregate control.  Such a
description is typically retrieved by HTTP or other non-RTSP means. 
However, they may be received with {\ANNOUNCE} methods.

\item[non-aggregate control:] A presentation composed of multiple
streams from a single server that are not available for aggregate control. 
Such a description is typically returned in reply to a {\DESCRIBE}
request on a URL, or received in an {\ANNOUNCE} method. 

\end{description}

This appendix describes how an SDP file, retrieved, for example, through
HTTP, determines the operation of an RTSP session.  It also describes
how a client should interpret SDP content returned in reply to a
{\DESCRIBE} request.  SDP provides no mechanism by which a client
can distinguish, without human guidance, between several media streams
to be rendered simultaneously and a set of alternatives (e.g., two audio
streams spoken in different languages).

\subsection{Definitions}

The terms ``session-level'', ``media-level'' and other key/attribute
names and values used in this appendix are to be used as defined in SDP
(RFC 2327 \cite{rfc2327}):

\subsubsection{Control URL}
\label{sec:sdp-control-url}

The ``a=control:'' attribute is used to convey the control URL.  This
attribute is used both for the session and media descriptions.  If used
for individual media, it indicates the URL to be used for controlling
that particular media stream.  If found at the session level, the
attribute indicates the URL for aggregate control.

Example:
\begin{verbatim}
  a=control:rtsp://example.com/foo
\end{verbatim}

This attribute may contain either relative and absolute URLs, following
the rules and conventions set out in RFC 1808 \cite{rfc1808}. 
Implementations should look for a base URL in the following order:

\begin{enumerate}
\item the RTSP \header{Content-Base} field;
\item the RTSP \header{Content-Location} field;
\item the RTSP request URL.
\end{enumerate}

If this attribute contains only an asterisk (*), then the URL is treated as
if it were an empty embedded URL, and thus inherits the entire base
URL.

\subsubsection{Media Streams}

The ``m='' field is used to enumerate the streams.  It is expected that
all the specified streams will be rendered with appropriate
synchronization.  If the session is unicast, the port number serves as a
recommendation from the server to the client; the client still has to
include it in its {\SETUP} request and may ignore this recommendation. 
If the server has no preference, it {\SHOULD} set the port number value to
zero.

Example:
\begin{verbatim}
  m=audio 0 RTP/AVP 31
\end{verbatim}

\subsubsection{Payload Type(s)}

The payload type(s) are specified in the ``m='' field.  In case the
payload type is a static payload type from RFC 1890 \cite{rfc1890}, no
other information is required.  In case it is a dynamic payload type,
the media attribute ``rtpmap'' is used to specify what the media is. 
The ``encoding name'' within the ``rtpmap'' attribute may be one of
those specified in RFC 1890 (Sections 5 and 6), or an experimental
encoding with a ``X-'' prefix as specified in SDP (RFC 2327
\cite{rfc2327}).  Codec-specific parameters are not specified in this
field, but rather in the ``fmtp'' attribute described below. 
Implementors seeking to register new encodings should follow the
procedure in RFC 1890 \cite{rfc1890}.  If the media type is not suited
to the RTP AV profile, then it is recommended that a new profile be
created and the appropriate profile name be used in lieu of ``RTP/AVP''
in the ``m='' field.

\subsubsection{Format-Specific Parameters}

Format-specific parameters are conveyed using the ``fmtp'' media
attribute.  The syntax of the ``fmtp'' attribute is specific to the
encoding(s) that the attribute refers to.  Note that the packetization
interval is conveyed using the ``ptime'' attribute.

\subsubsection{Range of Presentation}

The ``a=range'' attribute defines the total time range of the stored
session.  (The length of live sessions can be deduced from the ``t'' and
``r'' parameters.) Unless the presentation contains media streams of
different durations, the length attribute is a session-level attribute. 
The unit is specified first, followed by the value range.  The units and
their values are as defined in Section \ref{sec:smpte}, \ref{sec:npt}
and \ref{sec:clock}.

Examples:
\begin{verbatim}
  a=range:npt=0-34.4368
  a=range:clock=19971113T2115-19971113T2203
\end{verbatim}

\subsubsection{Time of Availability}

The ``t='' field {\MUST} contain suitable values for the start and stop
times for both aggregate and non-aggregate stream control.  With
aggregate control, the server {\SHOULD} indicate a stop time value for
which it guarantees the description to be valid, and a start time that
is equal to or before the time at which the {\DESCRIBE} request was
received.  It {\MAY} also indicate start and stop times of 0, meaning
that the session is always available.  With non-aggregate control, the
values should reflect the actual period for which the session is
available in keeping with SDP semantics, and not depend on other means
(such as the life of the web page containing the description) for this
purpose.

\subsubsection{Connection Information}

In SDP, the ``c='' field contains the destination address for the media
stream.  However, for on-demand unicast streams and some multicast
streams, the destination address is specified by the client via the
{\SETUP} request.  Unless the media content has a fixed destination
address, the ``c='' field is to be set to a suitable null value.  For
addresses of type ``IP4'', this value is ``0.0.0.0''.

\subsubsection{Entity Tag}

The optional ``a=etag'' attribute identifies a version of the session
description.  It is opaque to the client.  {\SETUP} requests may
include this identifier in the \header{If-Match} field (see
section~\ref{sec:If-Match}) to only allow session establishment if this
attribute value still corresponds to that of the current description. 
The attribute value is opaque and may contain any character allowed
within SDP attribute values.

Example:
\begin{verbatim}
  a=etag:158bb3e7c7fd62ce67f12b533f06b83a
\end{verbatim}

\motivation{One could argue that the ``o='' field provides identical
functionality.  However, it does so in a manner that would put
constraints on servers that need to support multiple session description
types other than SDP for the same piece of media content.}

\subsection{Aggregate Control Not Available}

If a presentation does not support aggregate control and multiple media
sections are specified, each section {\MUST} have the control URL specified
via the ``a=control:'' attribute.

Example:
\begin{verbatim}
v=0
o=- 2890844256 2890842807 IN IP4 204.34.34.32
s=I came from a web page
c=IN IP4 0.0.0.0
t=0 0
m=video 8002 RTP/AVP 31
a=control:rtsp://audio.com/movie.aud
m=audio 8004 RTP/AVP 3
a=control:rtsp://video.com/movie.vid
\end{verbatim}

Note that the position of the control URL in the description implies
that the client establishes separate RTSP control sessions to the
servers {\tt audio.com} and {\tt video.com}.

It is recommended that an SDP file contains the complete media
initialization information even if it is delivered to the media client
through non-RTSP means.  This is necessary as there is no mechanism to
indicate that the client should request more detailed media stream
information via {\DESCRIBE}.

\subsection{Aggregate Control Available}

In this scenario, the server has multiple streams that can be controlled
as a whole.  In this case, there are both a media-level ``a=control:''
attributes, which are used to specify the stream URLs, and a
session-level ``a=control:'' attribute which is used as the request URL
for aggregate control.  If the media-level URL is relative, it is
resolved to absolute URLs according to Section~\ref{sec:sdp-control-url}
above.

If the presentation comprises only a single stream, the media-level
``a=control:'' attribute may be omitted altogether.  However, if the
presentation contains more than one stream, each media stream section
{\MUST} contain its own ``a=control'' attribute.

Example:
\begin{verbatim}
v=0
o=- 2890844256 2890842807 IN IP4 204.34.34.32
s=I contain
i=<more info>
c=IN IP4 0.0.0.0
t=0 0
a=control:rtsp://example.com/movie/
m=video 8002 RTP/AVP 31
a=control:trackID=1
m=audio 8004 RTP/AVP 3
a=control:trackID=2
\end{verbatim}

In this example, the client is required to establish a single RTSP
session to the server, and uses the URLs {\tt
rtsp://example.com/movie/trackID=1} and {\tt
rtsp://example.com/movie/trackID=2} to set up the video and audio
streams, respectively.  The URL {\tt rtsp://example.com/movie/} controls
the whole movie.

\begin{changebar}
A client is \textbf{not} required to issues {\SETUP} requests for all
streams within an aggregate object. Servers {\SHOULD} allow the client
to ask for only a subset of the streams.
\end{changebar}
