Commit Graph

113 Commits

Author SHA1 Message Date
Alessandro Ros
4f3337f56c set SSRC of outgoing packets (#803)
In client and server, each format now has a fixed, unique, known in
advance SSRC, that is applied to outgoing packets belonging to each
format.

This is needed to support SRTP/MIKEY, that require each format to have
a fixed, unique, and known in advance SSRC.

A secondary effect is that SETUP responses now always contain SSRCs of
each format, regardless of the fact that the first packet has been
produced or not (previously we needed at least one packet, from which
the SSRC was extracted).
2025-07-05 11:08:57 +02:00
Alessandro Ros
b407cb1dd0 server: support reading back channels (#597) (#777) 2025-05-04 17:04:15 +02:00
Yuriy Gabuev
d162df21ec Allow setting response body in OnDescribe (#758)
* Allow setting response body in OnDescribe

Since commit 8c6495c33b, the server can no
longer directly specify the response body to DESCRIBE requests. This is
a breaking change and is a limitation for users who manually handle their
SDPs. This commit allows setting the body explicitly and takes it into
account if the `ServerStream` part of the `OnDecsribe` return value is
nil. If neither the stream, nor the body are set, the application panics.

* Add test for non-nil body for Describe
2025-04-17 12:43:01 +02:00
Alessandro Ros
61372cfa68 rename OnPacketLost2 into OnPacketsLost (#736) 2025-03-24 18:42:48 +01:00
Alessandro Ros
fcb018151b make ServerStream return an error if initialized before Server (#719) (#728) 2025-03-23 16:17:34 +01:00
Alessandro Ros
376fb9e821 replace New* with Initialize (#723) 2025-03-16 13:58:35 +01:00
Alessandro Ros
55556f1ecf add ServerConn.VerifyCredentials() (#555) 2025-02-18 17:39:04 +01:00
Alessandro Ros
885a9975ef rename auth.Validate into auth.Verify (#698) 2025-02-14 11:34:55 +01:00
Alessandro Ros
72e74f349e server: use relative control attributes (#620) 2024-09-15 22:51:55 +02:00
Alessandro Ros
3f62e11795 simplify usage of auth.Validate (#557) 2024-05-03 22:42:50 +02:00
Alessandro Ros
363b48e632 update golangci-lint (#554) 2024-04-28 18:20:25 +02:00
Alessandro Ros
24ed937861 update golangci-lint (#535) 2024-03-19 12:50:26 +01:00
Alessandro Ros
93b02bc0e8 simplify tests (#461) 2023-11-07 23:21:33 +01:00
database64128
b8838ca595 server: fix crash in case of requests with nil URL (#458)
---------

Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2023-11-07 16:50:57 +01:00
aler9
cdbecb1f5d allow setting additional properties of streams through description.Stream 2023-08-22 16:46:18 +02:00
aler9
68d4bf8da0 add *Server argument to NewServerStream() 2023-08-16 13:26:17 +02:00
aler9
ca87733ded remove suffix from new functions 2023-08-16 13:26:17 +02:00
aler9
80106144e6 bump to v4 2023-08-16 13:26:17 +02:00
aler9
17acec3f0d fix race condition in tests 2023-08-05 14:28:12 +02:00
aler9
8ef42a27e9 restore API compatibility 2023-07-31 10:07:25 +02:00
aler9
8b8b52e689 return an error in case the random number generator fails 2023-07-30 22:40:34 +02:00
Alessandro Ros
356b88021d update golangci-lint (#328) 2023-07-24 19:59:05 +02:00
Alessandro Ros
19dcd3e067 update golangci-lint (#292) 2023-05-28 13:40:00 +02:00
Alessandro Ros
7c67221494 auth: add Validate() and deprecate Validator{} (#272) 2023-05-07 19:34:20 +02:00
Alessandro Ros
9e29555063 simplify tests (#247) 2023-04-14 11:53:37 +02:00
Alessandro Ros
1f19f3cdb8 simplify tests (#245) 2023-04-13 12:01:57 +02:00
Alessandro Ros
2fbba142cc add OnTransportSwitch, OnPacketLost, OnDecodeError to server and client (#225)
These new hooks replace the generic hooks Log() and OnWarning().
2023-04-04 17:10:37 +02:00
Alessandro Ros
04f5a4041c change owner (#217) 2023-03-31 12:34:07 +02:00
Alessandro Ros
1ad059a80b server: use absolute RTSP URL as control attribute (#210)
this is necessary in order to make GStreamer's rtspsrc to send query parameters correctly in SETUP requests.
2023-03-24 10:54:14 +01:00
Alessandro Ros
a2d6ce8af6 replace OnDecodeError with OnWarning (#177) 2023-01-23 12:54:57 +01:00
aler9
645f9462e2 server: support publishing/reading to/from path '/' or '' 2023-01-11 00:39:58 +01:00
Alessandro Ros
ae9dac0ad3 use random UUIDs as media IDs (#163)
* remove Medias.Clone(), Media.Clone(), Format.Clone()

* server: use random UUIDs as media IDs

* client: use random UUIDs as media IDs
2022-12-22 20:32:28 +01:00
aler9
46cbb885b7 improve coverage 2022-12-11 23:40:01 +01:00
Alessandro Ros
a1396206b5 convert Tracks into Medias and Formats (#155)
* split tracks from medias

* move tracks into dedicated package

* move media into dedicated package

* edit Medias.Marshal() in order to return SDP

* add medias.Find() and simplify examples

* improve coverage

* fix rebase errors

* replace TrackIDs with MediaIDs

* implement media-specific and track-specific callbacks for reading RTCP and RTP packets

* rename publish into record, read into play

* add v2 tag

* rename tracks into formats
2022-12-11 22:03:22 +01:00
Alessandro Ros
51b8063325 rtph264: return error in decoder if packetization-mode is 2 (#153) 2022-11-14 21:23:13 +01:00
Jon Lech Johansen
76460d6404 Fix parsing of Transport header with multiple transports. (#145)
* Fix parsing of Transport header with multiple transports.

* Lint.

* Add test for Transport header with multiple transports.

* Filter out unsupported transports.

* Handle multicast properly when filtering out unsupported transports.

* Minor code cleanup.

* add Transports.Unmarshal(), add additional tests

Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2022-11-09 12:00:33 +01:00
aler9
ededb490bc server: when a session is closed, close all associated connections
regardless of the fact that they use TCP or UDP
2022-11-03 21:10:26 +01:00
aler9
9216576d49 server: allow to associate user data to connections 2022-11-03 12:57:42 +01:00
aler9
08a16e7b38 server: allow to associate user data to sessions (#50) 2022-11-03 12:02:38 +01:00
aler9
30e029011b add OnDecodeError callback to both client and server
This allows to detect decode errors of RTP and RTCP packets
2022-10-31 12:36:30 +01:00
aler9
27f8015ac6 simplify usage of Conn 2022-08-15 00:10:21 +02:00
aler9
06bed24dd9 add intermediate layer between net.Conn and client / server 2022-08-14 23:43:01 +02:00
aler9
a2c6a7fb97 server: change behavior in case of unhandled methods
(https://github.com/aler9/rtsp-simple-server/issues/1066)

Return 501 and keep connection open instead of returning 400 and
closing the connection.
2022-08-07 13:51:12 +02:00
aler9
4940e8faeb server: add Session to ServerHandlerOnSetParameterCtx 2022-08-07 13:43:59 +02:00
aler9
f3b0fc69b4 rename Read / Write into Unmarshal / Marshal when needed
Read() / Write() are used to read / write from streams, while
Unmarshal() / Marshal() are used to decode / encode from / to bytes.
2022-06-27 17:27:16 +02:00
aler9
9f4fea8a01 change track initialization method 2022-06-23 13:13:36 +02:00
aler9
f4cc42eccc server: correctly close sessions in case of errors during SETUP
(https://github.com/aler9/rtsp-simple-server/issues/965)
2022-06-21 14:55:17 +02:00
aler9
322a7e2f95 split high level tests from standard tests 2022-06-03 11:08:11 +02:00
aler9
c1b10a80be allow writing primitives to static buffers 2022-05-11 15:26:44 +02:00
aler9
edeef85e9e accept io.Writer in Write() methods 2022-05-08 14:33:29 +02:00