-
Notifications
You must be signed in to change notification settings - Fork 373
/
Copy pathmodifications.patch
330 lines (304 loc) · 15.4 KB
/
modifications.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
diff --color -ruN '--exclude=.*' live/README.md live555/README.md
--- live/README.md 1970-01-01 01:00:00.000000000 +0100
+++ live555/README.md 2024-10-29 16:41:04.436369578 +0000
@@ -0,0 +1,26 @@
+# Build Instructions
+
+```bash
+./genMakefiles linux
+make -j4
+```
+
+Replace "linux" with your platform, e.g. avr32-linux, cygwin, freebsd, iphoneos, linux, linux-64bit, macosx, openbsd, solaris-64bit, etc (see config.PLATFORM files)
+
+You will find various executables:
+
+ * ./testProgs - contain various programs such as testRTSPClient to receive an RTSP stream
+ * ./proxyServer/live555ProxyServer - a great RTSP proxy server
+ * ./mediaServer/live555MediaServer - an RTSP media server for serving static files over RTSP
+
+# Changes to Master
+
+### Buffer sizes
+OutPacketBuffer::maxSize is increased to 2,000,000 bytes which makes live555 work better with buggy IP cameras.
+
+### Force port re-use
+Added -DALLOW_RTSP_SERVER_PORT_REUSE=1 to force reusing existing port (e.g. when restarting the proxy). Please ensure you never run multiple instances of the proxy on the same port!
+
+### Quit on TCP Errors
+Note, you may want to edit liveMedia/RTCP.cpp#442 to change break to exit(1); - this ensures that live555 does not flood the screen and/or log with:
+"The remote endpoint is using a buggy implementation of RTP/RTCP-over-TCP. Please upgrade it!"
diff --color -ruN '--exclude=.*' live/config.linux live555/config.linux
--- live/config.linux 2024-10-24 18:50:34.000000000 +0100
+++ live555/config.linux 2024-10-29 16:25:59.933532116 +0000
@@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I/usr/local/include -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
+COMPILE_OPTS = $(INCLUDES) -I/usr/local/include -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DALLOW_RTSP_SERVER_PORT_REUSE=1
C = c
C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS) $(CPPFLAGS) $(CFLAGS)
diff --color -ruN '--exclude=.*' live/liveMedia/MediaSink.cpp live555/liveMedia/MediaSink.cpp
--- live/liveMedia/MediaSink.cpp 2024-10-24 18:50:15.000000000 +0100
+++ live555/liveMedia/MediaSink.cpp 2024-10-29 16:24:08.523077243 +0000
@@ -110,7 +110,7 @@
////////// OutPacketBuffer //////////
-unsigned OutPacketBuffer::maxSize = 60000; // by default
+unsigned OutPacketBuffer::maxSize = 2000000; // by default
OutPacketBuffer
::OutPacketBuffer(unsigned preferredPacketSize, unsigned maxPacketSize, unsigned maxBufferSize)
diff --color -ruN '--exclude=.*' live/liveMedia/StreamParser.cpp live555/liveMedia/StreamParser.cpp
--- live/liveMedia/StreamParser.cpp 2024-10-24 18:50:15.000000000 +0100
+++ live555/liveMedia/StreamParser.cpp 2024-10-29 16:36:34.924622728 +0000
@@ -23,7 +23,7 @@
#include <string.h>
#include <stdlib.h>
-#define BANK_SIZE 150000
+#define BANK_SIZE 600000
void StreamParser::flushInput() {
fCurParserIndex = fSavedParserIndex = 0;
diff --color -ruN '--exclude=.*' live/mediaServer/DynamicRTSPServer.cpp live555/mediaServer/DynamicRTSPServer.cpp
--- live/mediaServer/DynamicRTSPServer.cpp 2024-10-24 18:50:15.000000000 +0100
+++ live555/mediaServer/DynamicRTSPServer.cpp 2024-10-29 16:24:07.355674689 +0000
@@ -68,15 +68,15 @@
sms = NULL;
} else {
- if (smsExists && isFirstLookupInSession) {
+ if (smsExists && isFirstLookupInSession) {
// Remove the existing "ServerMediaSession" and create a new one, in case the underlying
// file has changed in some way:
- removeServerMediaSession(sms);
+ removeServerMediaSession(sms);
sms = NULL;
- }
+ }
if (sms == NULL) {
- sms = createNewSMS(envir(), streamName, fid);
+ sms = createNewSMS(envir(), streamName, fid);
addServerMediaSession(sms);
}
@@ -145,12 +145,12 @@
} else if (strcmp(extension, ".264") == 0) {
// Assumed to be a H.264 Video Elementary Stream file:
NEW_SMS("H.264 Video");
- OutPacketBuffer::maxSize = 100000; // allow for some possibly large H.264 frames
+ OutPacketBuffer::maxSize = 2000000; // allow for some possibly large H.264 frames
sms->addSubsession(H264VideoFileServerMediaSubsession::createNew(env, fileName, reuseSource));
} else if (strcmp(extension, ".265") == 0) {
// Assumed to be a H.265 Video Elementary Stream file:
NEW_SMS("H.265 Video");
- OutPacketBuffer::maxSize = 100000; // allow for some possibly large H.265 frames
+ OutPacketBuffer::maxSize = 2000000; // allow for some possibly large H.265 frames
sms->addSubsession(H265VideoFileServerMediaSubsession::createNew(env, fileName, reuseSource));
} else if (strcmp(extension, ".mp3") == 0) {
// Assumed to be a MPEG-1 or 2 Audio file:
@@ -206,13 +206,13 @@
} else if (strcmp(extension, ".dv") == 0) {
// Assumed to be a DV Video file
// First, make sure that the RTPSinks' buffers will be large enough to handle the huge size of DV frames (as big as 288000).
- OutPacketBuffer::maxSize = 300000;
+ OutPacketBuffer::maxSize = 2000000;
NEW_SMS("DV Video");
sms->addSubsession(DVVideoFileServerMediaSubsession::createNew(env, fileName, reuseSource));
} else if (strcmp(extension, ".mkv") == 0 || strcmp(extension, ".webm") == 0) {
// Assumed to be a Matroska file (note that WebM ('.webm') files are also Matroska files)
- OutPacketBuffer::maxSize = 300000; // allow for some possibly large VP8 or VP9 frames
+ OutPacketBuffer::maxSize = 2000000; // allow for some possibly large VP8 or VP9 frames
NEW_SMS("Matroska video+audio+(optional)subtitles");
// Create a Matroska file server demultiplexor for the specified file.
diff --color -ruN '--exclude=.*' live/proxyServer/live555ProxyServer.cpp live555/proxyServer/live555ProxyServer.cpp
--- live/proxyServer/live555ProxyServer.cpp 2024-10-24 18:50:15.000000000 +0100
+++ live555/proxyServer/live555ProxyServer.cpp 2024-10-29 16:24:06.271238921 +0000
@@ -58,7 +58,7 @@
int main(int argc, char** argv) {
// Increase the maximum size of video frames that we can 'proxy' without truncation.
// (Such frames are unreasonably large; the back-end servers should really not be sending frames this large!)
- OutPacketBuffer::maxSize = 100000; // bytes
+ OutPacketBuffer::maxSize = 2000000; // bytes
// Begin by setting up our usage environment:
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
@@ -98,7 +98,7 @@
case 'T': {
// stream RTP and RTCP over a HTTP connection
if (argc > 2 && argv[2][0] != '-') {
- // The next argument is the HTTP server port number:
+ // The next argument is the HTTP server port number:
if (sscanf(argv[2], "%hu", &tunnelOverHTTPPortNum) == 1
&& tunnelOverHTTPPortNum > 0) {
++argv; --argc;
@@ -112,7 +112,7 @@
}
case 'p': {
- // specify a rtsp server port number
+ // specify a rtsp server port number
if (argc > 2 && argv[2][0] != '-') {
// The next argument is the rtsp server port number:
if (sscanf(argv[2], "%hu", &rtspServerPortNum) == 1
@@ -126,7 +126,7 @@
usage();
break;
}
-
+
case 'u': { // specify a username and password (to be used if the 'back end' (i.e., proxied) stream requires authentication)
if (argc < 4) usage(); // there's no argv[3] (for the "password")
username = argv[2];
@@ -159,7 +159,7 @@
++argv; --argc;
}
- if (argc < 2 && !proxyREGISTERRequests) usage(); // there must be at least one URL at the end
+ if (argc < 2 && !proxyREGISTERRequests) usage(); // there must be at least one URL at the end
// Make sure that the remaining arguments appear to be "rtsp://" (or "rtsps://") URLs:
int i;
for (i = 1; i < argc; ++i) {
diff --color -ruN '--exclude=.*' live/proxyServer/live555ProxyServer.cpp.save live555/proxyServer/live555ProxyServer.cpp.save
--- live/proxyServer/live555ProxyServer.cpp.save 2024-10-24 18:50:15.000000000 +0100
+++ live555/proxyServer/live555ProxyServer.cpp.save 2024-10-29 16:24:05.994261176 +0000
@@ -58,7 +58,7 @@
int main(int argc, char** argv) {
// Increase the maximum size of video frames that we can 'proxy' without truncation.
// (Such frames are unreasonably large; the back-end servers should really not be sending frames this large!)
- OutPacketBuffer::maxSize = 100000; // bytes
+ OutPacketBuffer::maxSize = 2000000; // bytes
// Begin by setting up our usage environment:
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
@@ -98,7 +98,7 @@
case 'T': {
// stream RTP and RTCP over a HTTP connection
if (argc > 2 && argv[2][0] != '-') {
- // The next argument is the HTTP server port number:
+ // The next argument is the HTTP server port number:
if (sscanf(argv[2], "%hu", &tunnelOverHTTPPortNum) == 1
&& tunnelOverHTTPPortNum > 0) {
++argv; --argc;
@@ -112,7 +112,7 @@
}
case 'p': {
- // specify a rtsp server port number
+ // specify a rtsp server port number
if (argc > 2 && argv[2][0] != '-') {
// The next argument is the rtsp server port number:
if (sscanf(argv[2], "%hu", &rtspServerPortNum) == 1
@@ -126,7 +126,7 @@
usage();
break;
}
-
+
case 'u': { // specify a username and password (to be used if the 'back end' (i.e., proxied) stream requires authentication)
if (argc < 4) usage(); // there's no argv[3] (for the "password")
username = argv[2];
@@ -159,7 +159,7 @@
++argv; --argc;
}
- if (argc < 2 && !proxyREGISTERRequests) usage(); // there must be at least one URL at the end
+ if (argc < 2 && !proxyREGISTERRequests) usage(); // there must be at least one URL at the end
// Make sure that the remaining arguments appear to be "rtsp://" (or "rtsps://") URLs:
int i;
for (i = 1; i < argc; ++i) {
diff --color -ruN '--exclude=.*' live/proxyServer/live555ProxyServer.cpp.test live555/proxyServer/live555ProxyServer.cpp.test
--- live/proxyServer/live555ProxyServer.cpp.test 2024-10-24 18:50:15.000000000 +0100
+++ live555/proxyServer/live555ProxyServer.cpp.test 2024-10-29 16:24:05.674289257 +0000
@@ -66,7 +66,7 @@
int main(int argc, char** argv) {
// Increase the maximum size of video frames that we can 'proxy' without truncation.
// (Such frames are unreasonably large; the back-end servers should really not be sending frames this large!)
- OutPacketBuffer::maxSize = 100000; // bytes
+ OutPacketBuffer::maxSize = 2000000; // bytes
// Begin by setting up our usage environment:
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
@@ -106,7 +106,7 @@
case 'T': {
// stream RTP and RTCP over a HTTP connection
if (argc > 2 && argv[2][0] != '-') {
- // The next argument is the HTTP server port number:
+ // The next argument is the HTTP server port number:
if (sscanf(argv[2], "%hu", &tunnelOverHTTPPortNum) == 1
&& tunnelOverHTTPPortNum > 0) {
++argv; --argc;
@@ -120,7 +120,7 @@
}
case 'p': {
- // specify a rtsp server port number
+ // specify a rtsp server port number
if (argc > 2 && argv[2][0] != '-') {
// The next argument is the rtsp server port number:
if (sscanf(argv[2], "%hu", &rtspServerPortNum) == 1
@@ -134,7 +134,7 @@
usage();
break;
}
-
+
case 'u': { // specify a username and password (to be used if the 'back end' (i.e., proxied) stream requires authentication)
if (argc < 4) usage(); // there's no argv[3] (for the "password")
username = argv[2];
@@ -167,7 +167,7 @@
++argv; --argc;
}
- if (argc < 2 && !proxyREGISTERRequests) usage(); // there must be at least one URL at the end
+ if (argc < 2 && !proxyREGISTERRequests) usage(); // there must be at least one URL at the end
// Make sure that the remaining arguments appear to be "rtsp://" (or "rtsps://") URLs:
int i;
for (i = 1; i < argc; ++i) {
diff --color -ruN '--exclude=.*' live/testProgs/playCommon.cpp live555/testProgs/playCommon.cpp
--- live/testProgs/playCommon.cpp 2024-10-24 18:50:15.000000000 +0100
+++ live555/testProgs/playCommon.cpp 2024-10-29 16:37:42.764899604 +0000
@@ -114,7 +114,7 @@
unsigned movieFPS = 15; // default
Boolean movieFPSOptionSet = False;
char const* fileNamePrefix = "";
-unsigned fileSinkBufferSize = 100000;
+unsigned fileSinkBufferSize = 600000;
unsigned socketInputBufferSize = 0;
Boolean packetLossCompensate = False;
Boolean syncStreams = False;
diff --color -ruN '--exclude=.*' live/testProgs/testDVVideoStreamer.cpp live555/testProgs/testDVVideoStreamer.cpp
--- live/testProgs/testDVVideoStreamer.cpp 2024-10-24 18:50:15.000000000 +0100
+++ live555/testProgs/testDVVideoStreamer.cpp 2024-10-29 16:24:05.345390500 +0000
@@ -58,7 +58,7 @@
// Create a 'DV Video RTP' sink from the RTP 'groupsock':
// (But first, make sure that its buffers will be large enough to handle the huge size of DV frames (as big as 288000).)
- OutPacketBuffer::maxSize = 300000;
+ OutPacketBuffer::maxSize = 2000000;
videoSink = DVVideoRTPSink::createNew(*env, &rtpGroupsock, 96);
// Create (and start) a 'RTCP instance' for this RTP sink:
diff --color -ruN '--exclude=.*' live/testProgs/testH264VideoStreamer.cpp live555/testProgs/testH264VideoStreamer.cpp
--- live/testProgs/testH264VideoStreamer.cpp 2024-10-24 18:50:15.000000000 +0100
+++ live555/testProgs/testH264VideoStreamer.cpp 2024-10-29 16:24:04.972535953 +0000
@@ -63,7 +63,7 @@
rtcpGroupsock.multicastSendOnly(); // we're a SSM source
// Create a 'H264 Video RTP' sink from the RTP 'groupsock':
- OutPacketBuffer::maxSize = 100000;
+ OutPacketBuffer::maxSize = 2000000;
videoSink = H264VideoRTPSink::createNew(*env, &rtpGroupsock, 96);
// Create (and start) a 'RTCP instance' for this RTP sink:
diff --color -ruN '--exclude=.*' live/testProgs/testH265VideoStreamer.cpp live555/testProgs/testH265VideoStreamer.cpp
--- live/testProgs/testH265VideoStreamer.cpp 2024-10-24 18:50:15.000000000 +0100
+++ live555/testProgs/testH265VideoStreamer.cpp 2024-10-29 16:24:04.597527758 +0000
@@ -64,7 +64,7 @@
rtcpGroupsock.multicastSendOnly(); // we're a SSM source
// Create a 'H265 Video RTP' sink from the RTP 'groupsock':
- OutPacketBuffer::maxSize = 100000;
+ OutPacketBuffer::maxSize = 2000000;
videoSink = H265VideoRTPSink::createNew(*env, &rtpGroupsock, 96);
// Create (and start) a 'RTCP instance' for this RTP sink:
diff --color -ruN '--exclude=.*' live/testProgs/testOnDemandRTSPServer.cpp live555/testProgs/testOnDemandRTSPServer.cpp
--- live/testProgs/testOnDemandRTSPServer.cpp 2024-10-24 18:50:15.000000000 +0100
+++ live555/testProgs/testOnDemandRTSPServer.cpp 2024-10-29 16:24:04.170857007 +0000
@@ -280,7 +280,7 @@
// A DV video stream:
{
// First, make sure that the RTPSinks' buffers will be large enough to handle the huge size of DV frames (as big as 288000).
- OutPacketBuffer::maxSize = 300000;
+ OutPacketBuffer::maxSize = 2000000;
char const* streamName = "dvVideoTest";
char const* inputFileName = "test.dv";
@@ -424,7 +424,7 @@
// (Note: If the input UDP source is unicast rather than multicast, then change this to NULL.)
portNumBits const inputPortNum = 1234;
// This causes the server to take its input from the stream sent by the "testMPEG2TransportStreamer" demo application.
- Boolean const inputStreamIsRawUDP = False;
+ Boolean const inputStreamIsRawUDP = False;
ServerMediaSession* sms
= ServerMediaSession::createNew(*env, streamName, streamName,
descriptionString);