|
| RTSPClient (AudioOutput &out) |
| Construct with an AudioOutput as decoding sink.
|
|
| RTSPClient (AudioStream &out) |
| Construct with an AudioStream as decoding sink.
|
|
| RTSPClient (Print &out) |
| Construct with a generic Print sink.
|
|
void | addDecoder (const char *mimeType, AudioDecoder &decoder) |
| Register a decoder to be auto-selected for the given MIME.
|
|
void | addNotifyAudioChange (AudioInfoSupport &bi) override |
| Adds target to be notified about audio changes.
|
|
AudioInfo | audioInfo () override |
| Audio info parsed from SDP for raw PCM encodings.
|
|
virtual AudioInfo | audioInfoOut () |
|
int | available () |
| Returns buffered RTP payload bytes available for copy().
|
|
bool | begin (IPAddress addr, uint16_t port, const char *path=nullptr) |
| Start RTSP session and UDP RTP reception.
|
|
void | clearNotifyAudioChange () override |
| Deletes all change notify subscriptions.
|
|
size_t | copy () |
| Copy the next buffered RTP payload into the decoder pipeline. Performs initial decoder selection based on SDP MIME.
|
|
void | end () |
| Stop streaming and close RTSP/UDP sockets.
|
|
bool | isNotifyActive () |
|
const char * | mime () const |
| Best-effort MIME derived from SDP (e.g. audio/L16, audio/aac).
|
|
| operator bool () |
|
uint8_t | payloadType () const |
| RTP payload type from SDP (0xFF if unknown).
|
|
bool | removeNotifyAudioChange (AudioInfoSupport &bi) override |
| Removes a target in order not to be notified about audio changes.
|
|
bool | setActive (bool active) |
| Pause or resume playback via RTSP PAUSE/PLAY.
|
|
void | setAudioInfo (AudioInfo info) override |
| Defines the input AudioInfo.
|
|
void | setConnectRetries (uint8_t retries) |
| Set number of TCP connect retries (default 2).
|
|
void | setConnectRetryDelayMs (uint32_t ms) |
| Set delay between connect retries in ms (default 500ms).
|
|
void | setHeaderTimeoutMs (uint32_t ms) |
| Set timeout (ms) for reading RTSP response headers. Increase if your server responds slowly. Default 3000ms.
|
|
void | setIdleDelay (uint32_t ms) |
| Set idle backoff delay (ms) for zero-return cases. Used in available() and copy() to avoid busy loops.
|
|
void | setNotifyActive (bool flag) |
|
void | setOutput (AudioOutput &out) |
| Define decoding sink as AudioOutput.
|
|
void | setOutput (AudioStream &out) |
| Define decoding sink as AudioStream.
|
|
void | setOutput (Print &out) |
| Define decoding sink as Print.
|
|
void | setPayloadOffset (uint8_t bytes) |
| Set additional RTP payload offset in bytes. Some payloads embed a small header before the actual audio data (e.g., RFC2250 4-byte header for MP3). This offset is added after the RTP header and any CSRC entries.
|
|
void | setResampleFactor (float factor) |
| Set resampling factor to stabilize buffers and playback. 1.0 means no resampling. factor > 1.0 speeds up (upsamples), factor < 1.0 slows down (downsamples). Useful to compensate clock drift between sender and receiver to prevent buffer overflows/underflows. Internally mapped to step size as step = 1.0 / factor.
|
|
|
void | buildTrackUrlFromBaseAndControl () |
|
void | buildUrls (const char *path) |
|
size_t | computeRtpPayloadOffset (const uint8_t *data, size_t length) |
|
bool | fail (const char *msg) |
|
bool | isAbsoluteRtspUrl (const char *url) |
|
void | maybeKeepalive () |
|
void | notifyAudioChange (AudioInfo info) |
|
bool | openUdpPorts () |
|
void | parseContentBaseFromHeaders (const char *headers) |
|
void | parseControlFromSdp (const char *sdp) |
|
void | parseSdp (const char *sdp) |
|
void | parseServerPortsFromHeaders (const char *headers) |
|
void | parseSessionFromHeaders (const char *headers) |
|
void | primeUdpPath () |
|
int | readExact (uint8_t *out, int len, uint32_t timeoutMs) |
|
bool | readUntilDoubleCRLF (char *buf, size_t buflen, int &used, uint32_t timeoutMs=3000) |
|
void | resetState () |
|
bool | sendSimpleRequest (const char *method, const char *url, const char *extraHeaders, size_t extraLen, char *outHeaders, size_t outHeadersLen, char *outBody, size_t outBodyLen, bool quiet=false) |
|
void | serviceUdp () |
|
bool | sniffUdpFor (uint32_t ms) |
|
bool | tcpCommit () |
|
size_t | tcpWrite (const uint8_t *data, size_t len) |
|
template<typename TcpClient, typename UdpSocket>
class audio_tools::RTSPClient< TcpClient, UdpSocket >
Efficient RTSP client for UDP/RTP audio with decoder pipeline.
Establishes an RTSP session (OPTIONS, DESCRIBE, SETUP/UDP, PLAY), binds a local UDP RTP port and receives RTP audio packets. The payload of each RTP packet is forwarded to an internal MultiDecoder. For raw PCM over RTP (e.g. L16) a DecoderNetworkFormat is used to convert network byte order into host format before writing to the configured output. For compressed formats, register decoders with addDecoder().
Usage:
- Construct and set an output via setOutput()
- Call begin(address, port)
- In your loop, call copy() to push RTP payloads to decoders
- Optionally control streaming via setActive(true/false)
- Optionally define resampling factor to prevent buffer over/underflows
Template parameters:
- TcpClient: TCP client type (e.g: WiFiClient)
- UdpSocket: UDP socket type (e.g: WiFiUDP)
- Author
- Phil Schatzmann