arduino-audio-tools
|
RTSP Server - Multi-client Audio Streaming Server. More...
#include <RTSPServer.h>
Public Types | |
using | streamer_t = RTSPAudioStreamerBase< Platform > |
Public Member Functions | |
RTSPServer (streamer_t &streamer, int port=8554, int core=1) | |
Construct RTSP server. | |
~RTSPServer () | |
Destructor - ensures proper cleanup of server resources. | |
bool | begin () |
bool | begin (const char *ssid, const char *password) |
Initialize WiFi and start RTSP server. | |
int | clientCount () |
audio_tools::Task & | getTaskHandle () |
operator bool () | |
Protected Member Functions | |
bool | runAsync () |
Start RTSP server asynchronously. | |
void | serverThreadLoop () |
Main server thread loop - listens for RTSP client connections. | |
void | sessionThreadLoop () |
Client session thread loop - handles RTSP protocol for individual clients. | |
void | stop () |
Stop the RTSP server and cleanup resources. | |
Protected Attributes | |
Platform::TcpClientType | client |
int | client_count = 0 |
int | core |
int | port |
Platform::TcpServerType * | server = nullptr |
audio_tools::Task | serverTask {"RTSPServerThread", 15000, 5, core} |
audio_tools::Task | sessionTask {"RTSPSessionTask", 15000, 8, core} |
streamer_t * | streamer = nullptr |
RTSP Server - Multi-client Audio Streaming Server.
The RTSPServer class implements a complete RTSP (Real Time Streaming Protocol) server that manages client connections and coordinates audio streaming sessions. This server:
|
inline |
Construct RTSP server.
Creates a new RTSP server instance configured to work with the specified RTSPAudioStreamer. The server will listen for client connections and coordinate streaming sessions.
streamer | Pointer to RTSPAudioStreamer that provides the audio data source. Must remain valid for the server's lifetime. |
port | TCP port number for RTSP connections (default 8554 - standard RTSP port) |
core | Core number to run server tasks on (platform-specific, default 1) |
|
inline |
Start the RTSP server
|
inline |
Initialize WiFi and start RTSP server.
Convenience method that connects to a WiFi network and then starts the RTSP server. This method blocks until WiFi connection is established, then starts the server asynchronously.
ssid | WiFi network name to connect to |
password | WiFi network password |
|
inlineprotected |
Start RTSP server asynchronously.
Begins listening for RTSP client connections on the configured port. The server runs in a separate FreeRTOS task, allowing the main program to continue executing. Client sessions are handled in additional tasks.
|
inlineprotected |
Main server thread loop - listens for RTSP client connections.
This member method implements the main server loop. It accepts incoming TCP connections from RTSP clients and creates session threads to handle each client's RTSP protocol communication.
|
inlineprotected |
Client session thread loop - handles RTSP protocol for individual clients.
This member method runs in a dedicated Task for each connected client. It creates an RTSPSession object and processes RTSP requests (DESCRIBE, SETUP, PLAY, TEARDOWN) until the client disconnects or an error occurs.