RTP over HTTP - Work Flow

We describe the overall working flow of tunneling RTP over HTTP by :

  1. Define MIME type
  2. Define transfer
  3. Receive requests
  4. Recognize RTP over HTTP
  5. Add POST hint and reply GET request
  6. Pass file descriptor to RTSP server

The following is a simple diagram for the overall process:

Define the relative MIME type of RTP over HTTP, application/x-rtsp-tunnelled, in file mime.types.

The format is <MIME type> <associated file extension> :

application/x-httpd-php3        php3
application/x-rtsp-tunnelled    sdp
audio/basic                     au snd
image/png                       png
text/html                       html htm
video/mpeg                      mpeg mpg mpe
text/css                        css

Define the UNIX domain socket path in boa.conf to communicate with the RTSP server in file boa.conf, and you may add comments beginning with the pound (#) sign.

The register format is Transfer <URI> <socket path>, and the process caches open file descriptor connected to . Here is an example :

# stp over http
Transfer /livea.sdp /var/run/http/fdipc
Transfer /liveb.sdp /var/run/http/fdipc
Note: Ensure the path is the same as that defined in the RTSP server.

Please refer boa.conf Directives to get the detail of other configurations.

Boa pre-processes the client request. In init_transfer(), some basic information of the request has been retrieved, such as URI, req-method, etc.

In the QuickTime POST request, the content length of 32767 is an arbitrary value, so we need some trick to prevent from infinite waiting. If the request method is POST, select() is used to read the following data until timeout, and the process continues regardless of the content length.

After receiving data, using get_mime_type() to retrieve the mime_type of the request. Through the comparison of the pre-defined mime.types, the process may recognize the RTP over HTTP request.

Once recognizing a RTP over HTTP request, boa has to reply to the HTTP GET requests but never replies to client HTTP POST requests.

On the other hand, the RTSP server can not tell apart GET and POST request from the URI messages, so we give the RTSP server a "POST" hint at the end of the message. "POST0" represents the missing of following data, and "POST1" describes the correct case.

At last, boa connects to the pre-defined socket path, sends client socket fd and its rquest to the RTSP server. Then the RTSP server takes over the management of replying RTP/RTCP packets.