Skip to content

Commit

Permalink
Bump to version 2018.08.28
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Gaufman committed Sep 2, 2018
1 parent 7f998f3 commit ceeb4f4
Show file tree
Hide file tree
Showing 20 changed files with 330 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef _BASICUSAGEENVIRONMENT_VERSION_HH
#define _BASICUSAGEENVIRONMENT_VERSION_HH

#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING "2018.04.25"
#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT 1524614400
#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING "2018.08.28"
#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT 1535414400

#endif
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ You will find various executables:

# Changes to Master

See modifications.patch to see exactly what was changed compared to vanilla.

### 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
liveMedia/RTCP.cpp#422 is changed 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!

### Add -d option
See Proxyserver_check_interPacketGap_2017.01.26.patch - This allows specifying a number of seconds of inactivity
before timing out the connection.
4 changes: 2 additions & 2 deletions UsageEnvironment/include/UsageEnvironment_version.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef _USAGEENVIRONMENT_VERSION_HH
#define _USAGEENVIRONMENT_VERSION_HH

#define USAGEENVIRONMENT_LIBRARY_VERSION_STRING "2018.04.25"
#define USAGEENVIRONMENT_LIBRARY_VERSION_INT 1524614400
#define USAGEENVIRONMENT_LIBRARY_VERSION_STRING "2018.08.28"
#define USAGEENVIRONMENT_LIBRARY_VERSION_INT 1535414400

#endif
10 changes: 5 additions & 5 deletions config.linux-with-shared-libraries
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# At least one interface changes, or is removed => CURRENT += 1; REVISION = 0; AGE = 0
# One or more interfaces were added, but no existing interfaces were changed or removed => CURRENT += 1; REVISION = 0; AGE += 1

libliveMedia_VERSION_CURRENT=62
libliveMedia_VERSION_REVISION=5
libliveMedia_VERSION_AGE=0
libliveMedia_VERSION_CURRENT=63
libliveMedia_VERSION_REVISION=3
libliveMedia_VERSION_AGE=1
libliveMedia_LIB_SUFFIX=so.$(shell expr $(libliveMedia_VERSION_CURRENT) - $(libliveMedia_VERSION_AGE)).$(libliveMedia_VERSION_AGE).$(libliveMedia_VERSION_REVISION)

libBasicUsageEnvironment_VERSION_CURRENT=1
Expand All @@ -18,9 +18,9 @@ libUsageEnvironment_VERSION_REVISION=0
libUsageEnvironment_VERSION_AGE=1
libUsageEnvironment_LIB_SUFFIX=so.$(shell expr $(libUsageEnvironment_VERSION_CURRENT) - $(libUsageEnvironment_VERSION_AGE)).$(libUsageEnvironment_VERSION_AGE).$(libUsageEnvironment_VERSION_REVISION)

libgroupsock_VERSION_CURRENT=9
libgroupsock_VERSION_CURRENT=10
libgroupsock_VERSION_REVISION=1
libgroupsock_VERSION_AGE=1
libgroupsock_VERSION_AGE=2
libgroupsock_LIB_SUFFIX=so.$(shell expr $(libgroupsock_VERSION_CURRENT) - $(libgroupsock_VERSION_AGE)).$(libgroupsock_VERSION_AGE).$(libgroupsock_VERSION_REVISION)
#####

Expand Down
45 changes: 44 additions & 1 deletion groupsock/GroupsockHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ extern "C" int initializeWinsockIfNecessary();
#include <stdarg.h>
#include <time.h>
#include <sys/time.h>
#if !defined(_WIN32)
#include <netinet/tcp.h>
#endif
#include <fcntl.h>
#define initializeWinsockIfNecessary() 1
#endif
Expand Down Expand Up @@ -217,8 +220,38 @@ Boolean makeSocketBlocking(int sock, unsigned writeTimeoutInMilliseconds) {
return result;
}

Boolean setSocketKeepAlive(int sock) {
#if defined(__WIN32__) || defined(_WIN32)
// How do we do this in Windows? For now, just make this a no-op in Windows:
#else
int const keepalive_enabled = 1;
if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void*)&keepalive_enabled, sizeof keepalive_enabled) < 0) {
return False;
}

#ifdef TCP_KEEPIDLE
int const keepalive_time = 180;
if (setsockopt(sock, IPPROTO_TCP, TCP_KEEPIDLE, (void*)&keepalive_time, sizeof keepalive_time) < 0) {
return False;
}
#endif

int const keepalive_count = 5;
if (setsockopt(sock, IPPROTO_TCP, TCP_KEEPCNT, (void*)&keepalive_count, sizeof keepalive_count) < 0) {
return False;
}

int const keepalive_interval = 20;
if (setsockopt(sock, IPPROTO_TCP, TCP_KEEPINTVL, (void*)&keepalive_interval, sizeof keepalive_interval) < 0) {
return False;
}
#endif

return True;
}

int setupStreamSocket(UsageEnvironment& env,
Port port, Boolean makeNonBlocking) {
Port port, Boolean makeNonBlocking, Boolean setKeepAlive) {
if (!initializeWinsockIfNecessary()) {
socketErr(env, "Failed to initialize 'winsock': ");
return -1;
Expand Down Expand Up @@ -284,6 +317,16 @@ int setupStreamSocket(UsageEnvironment& env,
}
}

// Set the keep alive mechanism for the TCP socket, to avoid "ghost sockets"
// that remain after an interrupted communication.
if (setKeepAlive) {
if (!setSocketKeepAlive(newSocket)) {
socketErr(env, "failed to set keep alive: ");
closeSocket(newSocket);
return -1;
}
}

return newSocket;
}

Expand Down
3 changes: 2 additions & 1 deletion groupsock/include/GroupsockHelper.hh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ along with this library; if not, write to the Free Software Foundation, Inc.,

int setupDatagramSocket(UsageEnvironment& env, Port port);
int setupStreamSocket(UsageEnvironment& env,
Port port, Boolean makeNonBlocking = True);
Port port, Boolean makeNonBlocking = True, Boolean setKeepAlive = False);

int readSocket(UsageEnvironment& env,
int socket, unsigned char* buffer, unsigned bufferSize,
Expand Down Expand Up @@ -59,6 +59,7 @@ unsigned increaseReceiveBufferTo(UsageEnvironment& env,
Boolean makeSocketNonBlocking(int sock);
Boolean makeSocketBlocking(int sock, unsigned writeTimeoutInMilliseconds = 0);
// A "writeTimeoutInMilliseconds" value of 0 means: Don't timeout
Boolean setSocketKeepAlive(int sock);

Boolean socketJoinGroup(UsageEnvironment& env, int socket,
netAddressBits groupAddress);
Expand Down
4 changes: 2 additions & 2 deletions groupsock/include/groupsock_version.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef _GROUPSOCK_VERSION_HH
#define _GROUPSOCK_VERSION_HH

#define GROUPSOCK_LIBRARY_VERSION_STRING "2018.04.25"
#define GROUPSOCK_LIBRARY_VERSION_INT 1524614400
#define GROUPSOCK_LIBRARY_VERSION_STRING "2018.08.28"
#define GROUPSOCK_LIBRARY_VERSION_INT 1535414400

#endif
2 changes: 1 addition & 1 deletion liveMedia/GenericMediaServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int GenericMediaServer::setUpOurSocket(UsageEnvironment& env, Port& ourPort) {
NoReuse dummy(env); // Don't use this socket if there's already a local server using it
#endif

ourSocket = setupStreamSocket(env, ourPort);
ourSocket = setupStreamSocket(env, ourPort, True, True);
if (ourSocket < 0) break;

// Make sure we have a big send buffer:
Expand Down
6 changes: 4 additions & 2 deletions liveMedia/Makefile.tail
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MISC_SINK_OBJS = MediaSink.$(OBJ) FileSink.$(OBJ) BasicUDPSink.$(OBJ) AMRAudioFi
MISC_FILTER_OBJS = uLawAudioFilter.$(OBJ)
TRANSPORT_STREAM_TRICK_PLAY_OBJS = MPEG2IndexFromTransportStream.$(OBJ) MPEG2TransportStreamIndexFile.$(OBJ) MPEG2TransportStreamTrickModeFilter.$(OBJ)

RTP_SOURCE_OBJS = RTPSource.$(OBJ) MultiFramedRTPSource.$(OBJ) SimpleRTPSource.$(OBJ) H261VideoRTPSource.$(OBJ) H264VideoRTPSource.$(OBJ) H265VideoRTPSource.$(OBJ) QCELPAudioRTPSource.$(OBJ) AMRAudioRTPSource.$(OBJ) JPEGVideoRTPSource.$(OBJ) VorbisAudioRTPSource.$(OBJ) TheoraVideoRTPSource.$(OBJ) VP8VideoRTPSource.$(OBJ) VP9VideoRTPSource.$(OBJ)
RTP_SOURCE_OBJS = RTPSource.$(OBJ) MultiFramedRTPSource.$(OBJ) SimpleRTPSource.$(OBJ) H261VideoRTPSource.$(OBJ) H264VideoRTPSource.$(OBJ) H265VideoRTPSource.$(OBJ) QCELPAudioRTPSource.$(OBJ) AMRAudioRTPSource.$(OBJ) JPEGVideoRTPSource.$(OBJ) VorbisAudioRTPSource.$(OBJ) TheoraVideoRTPSource.$(OBJ) VP8VideoRTPSource.$(OBJ) VP9VideoRTPSource.$(OBJ) RawVideoRTPSource.$(OBJ)
RTP_SINK_OBJS = RTPSink.$(OBJ) MultiFramedRTPSink.$(OBJ) AudioRTPSink.$(OBJ) VideoRTPSink.$(OBJ) TextRTPSink.$(OBJ)
RTP_INTERFACE_OBJS = RTPInterface.$(OBJ)
RTP_OBJS = $(RTP_SOURCE_OBJS) $(RTP_SINK_OBJS) $(RTP_INTERFACE_OBJS)
Expand Down Expand Up @@ -98,6 +98,8 @@ VP8VideoRTPSource.$(CPP): include/VP8VideoRTPSource.hh
include/VP8VideoRTPSource.hh: include/MultiFramedRTPSource.hh
VP9VideoRTPSource.$(CPP): include/VP9VideoRTPSource.hh
include/VP9VideoRTPSource.hh: include/MultiFramedRTPSource.hh
RawVideoRTPSource.$(CPP): include/RawVideoRTPSource.hh
include/RawVideoRTPSource.hh: include/MultiFramedRTPSource.hh
ByteStreamFileSource.$(CPP): include/ByteStreamFileSource.hh include/InputFile.hh
include/ByteStreamFileSource.hh: include/FramedFileSource.hh
ByteStreamMultiFileSource.$(CPP): include/ByteStreamMultiFileSource.hh
Expand Down Expand Up @@ -383,7 +385,7 @@ ourMD5.$(CPP): include/ourMD5.hh
Base64.$(CPP): include/Base64.hh
Locale.$(CPP): include/Locale.hh

include/liveMedia.hh:: include/MPEG1or2AudioRTPSink.hh include/MP3ADURTPSink.hh include/MPEG1or2VideoRTPSink.hh include/MPEG4ESVideoRTPSink.hh include/BasicUDPSink.hh include/AMRAudioFileSink.hh include/H264VideoFileSink.hh include/H265VideoFileSink.hh include/OggFileSink.hh include/GSMAudioRTPSink.hh include/H263plusVideoRTPSink.hh include/H264VideoRTPSink.hh include/H265VideoRTPSink.hh include/DVVideoRTPSource.hh include/DVVideoRTPSink.hh include/DVVideoStreamFramer.hh include/H264VideoStreamFramer.hh include/H265VideoStreamFramer.hh include/H264VideoStreamDiscreteFramer.hh include/H265VideoStreamDiscreteFramer.hh include/JPEGVideoRTPSink.hh include/SimpleRTPSink.hh include/uLawAudioFilter.hh include/MPEG2IndexFromTransportStream.hh include/MPEG2TransportStreamTrickModeFilter.hh include/ByteStreamMultiFileSource.hh include/ByteStreamMemoryBufferSource.hh include/BasicUDPSource.hh include/SimpleRTPSource.hh include/MPEG1or2AudioRTPSource.hh include/MPEG4LATMAudioRTPSource.hh include/MPEG4LATMAudioRTPSink.hh include/MPEG4ESVideoRTPSource.hh include/MPEG4GenericRTPSource.hh include/MP3ADURTPSource.hh include/QCELPAudioRTPSource.hh include/AMRAudioRTPSource.hh include/JPEGVideoRTPSource.hh include/JPEGVideoSource.hh include/MPEG1or2VideoRTPSource.hh include/VorbisAudioRTPSource.hh include/TheoraVideoRTPSource.hh include/VP8VideoRTPSource.hh include/VP9VideoRTPSource.hh
include/liveMedia.hh:: include/MPEG1or2AudioRTPSink.hh include/MP3ADURTPSink.hh include/MPEG1or2VideoRTPSink.hh include/MPEG4ESVideoRTPSink.hh include/BasicUDPSink.hh include/AMRAudioFileSink.hh include/H264VideoFileSink.hh include/H265VideoFileSink.hh include/OggFileSink.hh include/GSMAudioRTPSink.hh include/H263plusVideoRTPSink.hh include/H264VideoRTPSink.hh include/H265VideoRTPSink.hh include/DVVideoRTPSource.hh include/DVVideoRTPSink.hh include/DVVideoStreamFramer.hh include/H264VideoStreamFramer.hh include/H265VideoStreamFramer.hh include/H264VideoStreamDiscreteFramer.hh include/H265VideoStreamDiscreteFramer.hh include/JPEGVideoRTPSink.hh include/SimpleRTPSink.hh include/uLawAudioFilter.hh include/MPEG2IndexFromTransportStream.hh include/MPEG2TransportStreamTrickModeFilter.hh include/ByteStreamMultiFileSource.hh include/ByteStreamMemoryBufferSource.hh include/BasicUDPSource.hh include/SimpleRTPSource.hh include/MPEG1or2AudioRTPSource.hh include/MPEG4LATMAudioRTPSource.hh include/MPEG4LATMAudioRTPSink.hh include/MPEG4ESVideoRTPSource.hh include/MPEG4GenericRTPSource.hh include/MP3ADURTPSource.hh include/QCELPAudioRTPSource.hh include/AMRAudioRTPSource.hh include/JPEGVideoRTPSource.hh include/JPEGVideoSource.hh include/MPEG1or2VideoRTPSource.hh include/VorbisAudioRTPSource.hh include/TheoraVideoRTPSource.hh include/VP8VideoRTPSource.hh include/VP9VideoRTPSource.hh include/RawVideoRTPSource.hh

include/liveMedia.hh:: include/MPEG2TransportStreamFromPESSource.hh include/MPEG2TransportStreamFromESSource.hh include/MPEG2TransportStreamFramer.hh include/ADTSAudioFileSource.hh include/H261VideoRTPSource.hh include/H263plusVideoRTPSource.hh include/H264VideoRTPSource.hh include/H265VideoRTPSource.hh include/MP3FileSource.hh include/MP3ADU.hh include/MP3ADUinterleaving.hh include/MP3Transcoder.hh include/MPEG1or2DemuxedElementaryStream.hh include/MPEG1or2AudioStreamFramer.hh include/MPEG1or2VideoStreamDiscreteFramer.hh include/MPEG4VideoStreamDiscreteFramer.hh include/H263plusVideoStreamFramer.hh include/AC3AudioStreamFramer.hh include/AC3AudioRTPSource.hh include/AC3AudioRTPSink.hh include/VorbisAudioRTPSink.hh include/TheoraVideoRTPSink.hh include/VP8VideoRTPSink.hh include/VP9VideoRTPSink.hh include/MPEG4GenericRTPSink.hh include/DeviceSource.hh include/AudioInputDevice.hh include/WAVAudioFileSource.hh include/StreamReplicator.hh include/RTSPRegisterSender.hh

Expand Down
3 changes: 3 additions & 0 deletions liveMedia/MediaSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,9 @@ Boolean MediaSubsession::createSourceObjects(int useSpecialRTPoffset) {
} else if (strcmp(fCodecName, "THEORA") == 0) { // Theora video
fReadSource = fRTPSource
= TheoraVideoRTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat);
} else if (strcmp(fCodecName, "RAW") == 0) { // Uncompressed raw video (RFC 4175)
fReadSource = fRTPSource
= RawVideoRTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat, fRTPTimestampFrequency);
} else if (strcmp(fCodecName, "VP8") == 0) { // VP8 video
fReadSource = fRTPSource
= VP8VideoRTPSource::createNew(env(), fRTPSocket,
Expand Down
2 changes: 1 addition & 1 deletion liveMedia/RTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void RTCPInstance::incomingReportHandler1() {
envir() << "RTCPInstance error: Hit limit when reading incoming packet over TCP. (fNumBytesAlreadyRead ("
<< fNumBytesAlreadyRead << ") >= maxRTCPPacketSize (" << maxRTCPPacketSize
<< ")). The remote endpoint is using a buggy implementation of RTP/RTCP-over-TCP. Please upgrade it!\n";
break;
exit(1);
}

unsigned numBytesRead;
Expand Down
9 changes: 8 additions & 1 deletion liveMedia/RTSPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ void RTSPServer::RTSPClientConnection::handleRequestBytes(int newBytesRead) {
char cseq[RTSP_PARAM_STRING_MAX];
char sessionIdStr[RTSP_PARAM_STRING_MAX];
unsigned contentLength = 0;
Boolean playAfterSetup = False;
fLastCRLF[2] = '\0'; // temporarily, for parsing
Boolean parseSucceeded = parseRTSPRequestString((char*)fRequestBuffer, fLastCRLF+2 - fRequestBuffer,
cmdName, sizeof cmdName,
Expand All @@ -708,7 +709,13 @@ void RTSPServer::RTSPClientConnection::handleRequestBytes(int newBytesRead) {
sessionIdStr, sizeof sessionIdStr,
contentLength);
fLastCRLF[2] = '\r'; // restore its value
Boolean playAfterSetup = False;
// Check first for a bogus "Content-Length" value that would cause a pointer wraparound:
if (tmpPtr + 2 + contentLength < tmpPtr + 2) {
#ifdef DEBUG
fprintf(stderr, "parseRTSPRequestString() returned a bogus \"Content-Length:\" value: 0x%x (%d)\n", contentLength, (int)contentLength);
#endif
parseSucceeded = False;
}
if (parseSucceeded) {
#ifdef DEBUG
fprintf(stderr, "parseRTSPRequestString() succeeded, returning cmdName \"%s\", urlPreSuffix \"%s\", urlSuffix \"%s\", CSeq \"%s\", Content-Length %u, with %d bytes following the message.\n", cmdName, urlPreSuffix, urlSuffix, cseq, contentLength, ptr + newBytesRead - (tmpPtr + 2));
Expand Down
Loading

0 comments on commit ceeb4f4

Please sign in to comment.