Commit Graph

146 Commits

Author SHA1 Message Date
aler9
bf12e12afd client: decrease security issues with AnyPortEnable
When AnyPortEnable is true, store the port of the first incoming packet
and check that following packets use the same port
2023-01-07 11:06:10 +01:00
aler9
5a2ea9cf9c partially revert cabfcd6 2022-12-22 20:36:41 +01:00
aler9
cabfcd627b client: do not override media controls inside Announce()
this fixes the client-read-republish example and allows users to set
their own media controls.

Function medias.SetControls() is provided in order to automatically set
media controls and must be called manually.
2022-12-22 18:54:09 +01:00
aler9
ffe8c87c38 fix overriding of previously-received RTP packets that leaded to crashes
RTP packets were previously take from a buffer pool. This was messing
up the Client, since that buffer pool was used by multiple routines at
once, and was probably messing up the Server too, since packets can be
pushed to different queues and there's no guarantee that these queues
have an overall size less than ReadBufferCount.

This buffer pool is removed; this decreases performance but avoids bugs.
2022-12-19 13:51:49 +01:00
aler9
38b24b8e26 rename 'track' references into 'format' 2022-12-13 18:06:41 +01:00
aler9
256877086b merge serverWriter and clientWriter 2022-12-11 22:54:16 +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
aler9
fa95f5a86b add Client.SetupAll() 2022-12-11 14:25:35 +01:00
aler9
99855bd3a2 allow invalid RTCP packets in both client and server
(https://github.com/aler9/rtsp-simple-server/issues/1085)

Invalid RTCP packets, in both server and client, do not trigger a fatal
error anymore but they're just blocked. OnDecodeError() is called in
order to emit a warning.
2022-12-09 12:48:33 +01:00
aler9
d521a785c4 support tracks without clock rate 2022-11-27 21:17:48 +01:00
aler9
9f5ab03742 headers: simplify usage of Range 2022-11-20 11:33:49 +01:00
Alessandro Ros
7951b2e4af allow to set NTP of outgoing packets in both client and server (#148) 2022-11-14 16:55:40 +01:00
aler9
12c8845fef client: add variables to store received and sent bytes 2022-11-10 22:15:34 +01:00
aler9
32f611270c add option to disable automatic RTCP sender reports (#111) 2022-11-02 17:32:42 +01:00
Alessandro Ros
7a4c7d6d66 remove h264 decoding and re-encoding (#144)
* stop re-encoding H264

* stop decoding H264

* improve tests
2022-11-02 14:38:05 +01:00
aler9
58bc92133a client: generate RTCP sender reports when publishing with TCP too 2022-11-02 12:26:28 +01:00
aler9
d9d6227906 client: simplify usage of Setup() 2022-11-01 09:58:08 +01:00
aler9
b1f72f9392 return error in OnDecodeError when there are oversized UDP packets 2022-10-31 15:53:15 +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
9b5071f505 update docs 2022-10-31 10:05:34 +01:00
aler9
92cc1b5ee9 update golangci-lint 2022-09-17 21:19:40 +02:00
aler9
25199d8e16 client: support cameras that sends invalid RTCP packets with TCP
(https://github.com/aler9/rtsp-simple-server/issues/1085)
2022-08-27 17:34:10 +02: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
234e4f4f8d client: fix RTSPS default port 2022-07-09 17:13:11 +02:00
aler9
e262385062 client: remove StartReading, StartReadingAndWait 2022-07-09 17:08:37 +02:00
aler9
36c6d0b7ef client: fix RTSPS default port 2022-07-09 16:53:25 +02:00
Alessandro Ros
df7336b5e8 implement packet reordering for UDP / Multicast transports (#132)
* implement packet reordering for UDP transport

* rtcpreceiver: stop handling unordered / duplicate packets

* remote useless Sleep() from tests
2022-07-05 23:29:03 +02:00
aler9
fb39087150 client: avoid sending/receiving invalid packet when reading with multicast 2022-07-05 22:54:40 +02:00
aler9
18005a9cde ringbuffer: force size to be a power of 2
otherwise buffer is used partially when writeIndex overflows.
2022-07-05 19:25:53 +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
2c1edabaed update docs 2022-06-23 10:39:13 +02:00
aler9
ac910c63db rename rtpproc into rtpcleaner 2022-06-11 19:50:38 +02:00
aler9
92ed04ad6c optimize RTP packet handling 2022-06-11 19:11:24 +02:00
aler9
98b6515c33 move RTP packet handling into separate package 2022-06-11 13:47:26 +02:00
aler9
2fa3148a27 move URL into dedicated folder 2022-06-05 01:27:19 +02:00
aler9
d40205e592 cleanup code 2022-06-02 18:04:22 +02:00
aler9
9e1595ea90 client: move base URL logic into dedicated function 2022-06-02 17:28:22 +02:00
Hiruna Wijesinghe
09304e1c2e Persist credentials on source redirections (#124)
* add client opt to persist credentials on source redirections

* Remove PersistCredentialsOnRedirect flag, persist creds (if any) by default on redirects

* remove useless check

Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2022-06-02 17:19:11 +02:00
aler9
811e189b43 client: support cameras that provide base URL inside control attribute (https://github.com/aler9/rtsp-simple-server/issues/683) 2022-05-11 16:51:48 +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
aler9
bdbce3c370 client: fix timeout (https://github.com/aler9/rtsp-simple-server/discussions/897)
that happens when there's a UDP->TCP switch and Content-Base contains
an absolute URL
2022-05-02 19:01:35 +02:00
aler9
c759021124 update docs 2022-04-21 17:03:44 +02:00
aler9
3a44c108c1 fix client-read-republish example (#120) 2022-04-21 17:03:32 +02:00
Tristan Matthews
2f8186c11a client: allow UserAgent to be set (#119)
* client: allow UserAgent to be set

* client: fix out of date comment
2022-04-15 13:32:34 +02:00
aler9
ff34f5ac1d improve performance 2022-04-10 15:12:33 +02:00
aler9
7bf907e94c improve performance 2022-04-10 11:29:15 +02:00
aler9
bfe4e8cdaa automatically remux oversized RTP/H264 packets; drop parameter ReadBufferSize 2022-04-09 20:16:14 +02:00
aler9
fb5d2c31ce client: fix h264 decoding 2022-04-08 17:52:24 +02:00