Search code examples
rtspsdp

SDP "a=control" field: streamID or trackID?


In RTSP, SDP is used to describe available streams. If there are multiple streams, such as an audio and a video stream, using a=control:<...> can be used to tell them apart.

In the examples found on the Net, there are two common forms in use:

  • a=control:streamid=Foo
  • a=control:trackID=Bar

I'm trying to figure out how these work. My current hypothesis is:

The RTSP server chooses what to use. The client must use the exact, literal string that follows a=control: as a relative URL for the particular stream (relative to the base URL of the SDP).

The two common forms are just conventions that people are copying from each other. Both are allowed, as they're just special cases of valid relative URLs. An RTSP client must support both, and in fact a=control:A226DA96-BCC1-4563-89C0-927F1EAFE28E is equally valid.

Is this hypothesis formally correct, and also workable in practice? Or are there common RTSP clients that have a narrower idea of what's allowed?


Solution

  • Your hypothesis is mostly correct. Everything after "a=control:" must be a relative URI or an absolute URI (whichever you prefer). The client should adapt, depending if it finds the RTSP schema at the start of the URI (absolute) or not (relative).

    Also, when using a relative URI (like in your two examples), the client should be able to receive anything after "a=control:" as long as it only contains valid characters for a RTSP URI. "streamid" and "trackID" have no meaning for the client. It should take the whole string ("streamid=Foo" or "trackID=Bar") and append it to the base RTSP URI. "A226DA96-BCC1-4563-89C0-927F1EAFE28E" would also be valid for any standard RTSP clients.

    You can find more details in the RFC of RTSP: https://www.ietf.org/rfc/rfc2326.txt (Section C.1.1)