arduino-audio-tools
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RTSPServer< Platform > Class Template Reference

RTSPServer - Multi-client Audio Streaming Server (task-based) More...

#include <RTSPServer.h>

Inheritance diagram for RTSPServer< Platform >:
RTSPServerBase< Platform >

Public Types

using streamer_t = RTSPAudioStreamerBase< Platform >
 

Public Member Functions

 RTSPServer (streamer_t &streamer, int port=8554, int core=1)
 
 ~RTSPServer ()
 
bool begin ()
 Start server.
 
bool begin (const char *ssid, const char *password)
 
int clientCount ()
 Get number of connected clients.
 
void end ()
 
 operator bool ()
 Returns true if any client is connected.
 
void setOnSessionPath (bool(*cb)(const char *path, void *ref), void *ref=nullptr)
 Set callback for session path.
 
void setSessionTimeoutMs (unsigned long ms)
 Set session timeout in milliseconds.
 

Protected Member Functions

void acceptClient ()
 Accept new client if none is active.
 
void handleSession ()
 Handle requests session if active.
 
void serverThreadLoop ()
 
void sessionThreadLoop ()
 

Protected Attributes

Platform::TcpClientType client
 
int client_count = 0
 
int core = 0
 
unsigned long lastRequestTime = 0
 
bool(* onSessionPathCb )(const char *, void *) = nullptr
 
voidonSessionPathRef = nullptr
 
int port = 554
 
RtspSession< Platform > * rtspSession = nullptr
 
Platform::TcpServerType * server = nullptr
 
audio_tools::Task serverTask {"RTSPServerThread", 10000, 5, core}
 
audio_tools::Task sessionTask {"RTSPSessionTask", 8000, 8, core}
 
unsigned long sessionTimeoutMs = 60000
 
RTSPAudioStreamerBase< Platform > * streamer = nullptr
 

Detailed Description

template<typename Platform>
class audio_tools::RTSPServer< Platform >

RTSPServer - Multi-client Audio Streaming Server (task-based)

This class extends RTSPServerBase to add task/thread management for handling RTSP sessions. It schedules the main server loop and individual session loops as tasks, allowing concurrent client handling on platforms that support threading (e.g., ESP32 with FreeRTOS).

Usage:

Inherits all protocol, session, and connection logic from RTSPServerBase. Only task scheduling and concurrency logic is implemented here.

Template Parameters
PlatformTarget hardware platform (e.g., Arduino, ESP32)

Member Typedef Documentation

◆ streamer_t

Constructor & Destructor Documentation

◆ RTSPServer()

template<typename Platform >
RTSPServer ( streamer_t streamer,
int  port = 8554,
int  core = 1 
)
inline

◆ ~RTSPServer()

template<typename Platform >
~RTSPServer ( )
inline

Member Function Documentation

◆ acceptClient()

template<typename Platform >
void acceptClient ( )
inlineprotectedinherited

Accept new client if none is active.

◆ begin() [1/2]

template<typename Platform >
bool begin ( )
inlinevirtual

Start server.

Reimplemented from RTSPServerBase< Platform >.

◆ begin() [2/2]

template<typename Platform >
bool begin ( const char ssid,
const char password 
)
inline

◆ clientCount()

template<typename Platform >
int clientCount ( )
inlineinherited

Get number of connected clients.

◆ end()

template<typename Platform >
void end ( )
inline

◆ handleSession()

template<typename Platform >
void handleSession ( )
inlineprotectedinherited

Handle requests session if active.

◆ operator bool()

template<typename Platform >
operator bool ( )
inlineinherited

Returns true if any client is connected.

◆ serverThreadLoop()

template<typename Platform >
void serverThreadLoop ( )
inlineprotected

◆ sessionThreadLoop()

template<typename Platform >
void sessionThreadLoop ( )
inlineprotected

◆ setOnSessionPath()

template<typename Platform >
void setOnSessionPath ( bool(*)(const char *path, void *ref)  cb,
void ref = nullptr 
)
inlineinherited

Set callback for session path.

◆ setSessionTimeoutMs()

template<typename Platform >
void setSessionTimeoutMs ( unsigned long  ms)
inlineinherited

Set session timeout in milliseconds.

Member Data Documentation

◆ client

template<typename Platform >
Platform::TcpClientType client
protectedinherited

◆ client_count

template<typename Platform >
int client_count = 0
protectedinherited

◆ core

template<typename Platform >
int core = 0
protected

◆ lastRequestTime

template<typename Platform >
unsigned long lastRequestTime = 0
protectedinherited

◆ onSessionPathCb

template<typename Platform >
bool(* onSessionPathCb) (const char *, void *) = nullptr
protectedinherited

◆ onSessionPathRef

template<typename Platform >
void* onSessionPathRef = nullptr
protectedinherited

◆ port

template<typename Platform >
int port = 554
protectedinherited

◆ rtspSession

template<typename Platform >
RtspSession<Platform>* rtspSession = nullptr
protectedinherited

◆ server

template<typename Platform >
Platform::TcpServerType* server = nullptr
protectedinherited

◆ serverTask

template<typename Platform >
audio_tools::Task serverTask {"RTSPServerThread", 10000, 5, core}
protected

◆ sessionTask

template<typename Platform >
audio_tools::Task sessionTask {"RTSPSessionTask", 8000, 8, core}
protected

◆ sessionTimeoutMs

template<typename Platform >
unsigned long sessionTimeoutMs = 60000
protectedinherited

◆ streamer

template<typename Platform >
RTSPAudioStreamerBase<Platform>* streamer = nullptr
protectedinherited

The documentation for this class was generated from the following file: