|
arduino-audio-tools
|
RTSP Session Handler - Individual Client Protocol Management. More...
#include <RTSPSession.h>
Public Member Functions | |
| RtspSession (typename Platform::TcpClientType &aClient, RTSPAudioStreamerBase< Platform > &aStreamer) | |
| Construct RTSP session for a connected client. | |
| ~RtspSession () | |
| Destructor - cleanup session resources. | |
| void | closeSession () |
| Mark session as closed (for server timeout/teardown) | |
| bool | handleRequests (uint32_t readTimeoutMs) |
| Process incoming RTSP requests from the client. | |
| bool | isSessionOpen () |
| bool | isStreaming () |
| void | setOnSessionPath (bool(*cb)(const char *path, void *ref), void *ref=nullptr) |
| Set a callback to receive the RTSP URL path that opened the session. The callback is invoked once, after the first request is parsed, with the path portion of the RTSP URL (starting with '/'). A user reference is provided back on invocation. | |
RTSP Session Handler - Individual Client Protocol Management.
The RtspSession class manages RTSP protocol communication with a single client. It handles the complete RTSP session lifecycle from initial connection through streaming termination. Key responsibilities include:
The memory for buffers is allocated in PSRAM if available and active.
|
inline |
Construct RTSP session for a connected client.
Creates a new RTSP session instance to handle protocol communication with a specific client. Initializes session state and prepares for RTSP message processing. Buffer initialization is handled by the init() method.
| aClient | WiFiClient object representing the connected RTSP client |
| aStreamer | Pointer to RTSPAudioStreamer that will provide audio data for this session |
|
inline |
Destructor - cleanup session resources.
Closes the RTSP client socket and ensures streaming is properly stopped. Vector buffers are automatically managed.
Mark session as closed (for server timeout/teardown)
Create the DateHeader string for RTSP responses
Gives the current stream ID
Process incoming RTSP requests from the client.
Reads RTSP messages from the client socket and dispatches them to appropriate handler methods. This is the main processing loop for RTSP protocol communication. Supports all standard RTSP commands (OPTIONS, DESCRIBE, SETUP, PLAY, TEARDOWN).
| readTimeoutMs | Maximum time in milliseconds to wait for incoming data |
Sends Response to DESCRIBE command
Sends Response to OPTIONS command
Sends Response to PAUSE command and stops RTP stream without closing session
Sends Response to PLAY command and starts the RTP stream
|
inlineprotected |
Parses the an RTSP request and calls the response function depending on the type of command
| aRequest | c string containing the request |
| aRequestSize | length of the request |
Sends Response to SETUP command and prepares RTP stream
Sends Response to TEARDOWN command, stops the RTP stream
Initializes memory and buffers
Lazily initializes Vector buffers if they haven't been allocated yet, and resets all RTSP parsing state variables to their default values. This method can be called multiple times safely.
Prepares sockets for RTP stream
| aRtpPort | local port number for RTP connection |
| aRtcpPort | local port number for RTCP connection |
Parses an RTSP request, storing the extracted information in the RTSPSession object
| aRequest | c string containing the request |
| aRequestSize | length of the request |
|
inlineprotected |
Inline helper to read from socket.
| sock | TCP socket to read from |
| buf | Buffer to read into |
| buflen | Buffer length |
| timeoutmsec | Timeout in milliseconds |
|
inlineprotected |
Inline helper to send data over socket.
| sock | TCP socket to send to |
| buf | Data buffer to send |
| len | Length of data |
Set a callback to receive the RTSP URL path that opened the session. The callback is invoked once, after the first request is parsed, with the path portion of the RTSP URL (starting with '/'). A user reference is provided back on invocation.
Return semantics:
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |