SR-RTP implementation notes

Integrating selective retransmission with the application is a tricky implementation task, but our system exports a simple API to make this integration relatively seamless. While decisions about whether a retransmission request should be made are based on the priority of surrounding fragments, the client application must also communicate with SR-RTP to inform the transport protocol about when various retransmissions are no longer necessary. For example, if a frame has already been played, no further retransmission requests should be made for packets belonging to that frame; this process is called cancellation.

To facilitate application level framing and cancellation, our system makes use of a callback-based API. When an ADU (i.e., frame) has been received in its entirety, SR-RTP makes a callback to the application, using srrtp_app_notify(adu_seqno, length). The application then reads the frame into the playout buffer. When 200 ms worth of frames (the initial amount of data that can be buffered without affecting interactivity) has been buffered, the application begins reading frames from the playout buffer for decoding. As each frame is read from the playout buffer, the application calls srrtp_update(adu_seqno), which tells the transport layer to stop requesting retransmission of packets that belong to frames that precede this frame (and also to ignore late-arriving packets from these frames).