Fix Cygwin compilation:
- Fix various incompatibilities and differences between Linux and Cygwin builds - Make usrsctp an optional dependency - Fix building without SSL - Add new secure random bytes function, use it for websockets - Switch to libsrtp2 v2.6.0 (currently latest release) - Add patch that makes latest libsrtp2 build in latest Cygwin - Add patch that makes srt build in latest Cygwin - Correctly allow linking libsrtp2 and srt to local mbedtls version
This commit is contained in:
parent
db30be38c5
commit
dbafa808b8
23 changed files with 131 additions and 23 deletions
|
@ -1121,7 +1121,7 @@ void Controller::statOnDisconnect(size_t id){
|
|||
dataPage.init(userPageName, 1, false, false);
|
||||
if(dataPage){
|
||||
// Session likely crashed while it was running
|
||||
dataPage.init(userPageName, 1, true);
|
||||
dataPage.master = true;
|
||||
FAIL_MSG("Session '%s' got cancelled unexpectedly. Cleaning up the leftovers...", thisSessionId.c_str());
|
||||
}
|
||||
// Finally remove the session lock which was created on bootup of the session
|
||||
|
|
|
@ -1604,6 +1604,7 @@ namespace Mist{
|
|||
if (connectedUsers || isAlwaysOn()){activityCounter = Util::bootSecs();}
|
||||
if (thisTime >= lastBuffered){
|
||||
if (sourceIdx != idx){
|
||||
#ifdef SSL
|
||||
if (encryption.find(":") != std::string::npos || M.getEncryption(idx).find(":") != std::string::npos){
|
||||
if (encryption == ""){
|
||||
encryption = M.getEncryption(idx);
|
||||
|
@ -1622,8 +1623,11 @@ namespace Mist{
|
|||
thisPacket = encPacket;
|
||||
}
|
||||
}else{
|
||||
#endif
|
||||
thisPacket = DTSC::Packet(thisPacket, idx);
|
||||
#ifdef SSL
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//Sanity check: are we matching the key's data size?
|
||||
if (thisPacket.getFlag("keyframe")){
|
||||
|
|
|
@ -5,13 +5,16 @@
|
|||
#include <mist/config.h>
|
||||
#include <mist/defines.h>
|
||||
#include <mist/dtsc.h>
|
||||
#include <mist/encryption.h>
|
||||
#include <mist/json.h>
|
||||
#include <mist/shared_memory.h>
|
||||
#include <mist/timing.h>
|
||||
#include <mist/url.h>
|
||||
#include <set>
|
||||
|
||||
#ifdef SSL
|
||||
#include <mist/encryption.h>
|
||||
#endif
|
||||
|
||||
#include "../io.h"
|
||||
|
||||
namespace Mist{
|
||||
|
@ -110,7 +113,9 @@ namespace Mist{
|
|||
Comms::Users users;
|
||||
size_t connectedUsers;
|
||||
|
||||
#ifdef SSL
|
||||
Encryption::AES aesCipher;
|
||||
#endif
|
||||
|
||||
IPC::sharedPage streamStatus;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "input_hls.h"
|
||||
#ifdef SSL
|
||||
#include "mbedtls/aes.h"
|
||||
#endif
|
||||
#include <algorithm>
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
|
|
|
@ -67,7 +67,9 @@ namespace Mist{
|
|||
Util::ResizeablePointer * currBuf;
|
||||
size_t encOffset;
|
||||
unsigned char tmpIvec[16];
|
||||
#ifdef SSL
|
||||
mbedtls_aes_context aes;
|
||||
#endif
|
||||
bool isOpen;
|
||||
};
|
||||
|
||||
|
|
|
@ -91,7 +91,9 @@ foreach output : outputs
|
|||
endif
|
||||
if extra.contains('srtp')
|
||||
sources += files('output_webrtc_srtp.cpp', 'output_webrtc_srtp.h')
|
||||
deps += usrsctp_dep
|
||||
if have_usrsctp
|
||||
deps += usrsctp_dep
|
||||
endif
|
||||
endif
|
||||
if extra.contains('embed')
|
||||
sources += embed_tgts
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace Mist{
|
|||
static void onRTPPacketizerHasDataCallback(void *socket, const char *data, size_t len, uint8_t channel);
|
||||
static void onRTPPacketizerHasRTCPDataCallback(void *socket, const char *data, size_t nbytes, uint8_t channel);
|
||||
|
||||
#ifdef WITH_DATACHANNELS
|
||||
static int sctp_recv_cb(struct socket *s, union sctp_sockstore addr, void *data, size_t datalen, struct sctp_rcvinfo rcv, int flags, void *ulp_info){
|
||||
if (data) {
|
||||
if (!(flags & MSG_NOTIFICATION)){
|
||||
|
@ -61,6 +62,7 @@ namespace Mist{
|
|||
va_end(args);
|
||||
INFO_MSG("sctp: %s", msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
WebRTCSocket::WebRTCSocket(){
|
||||
udpSock = 0;
|
||||
|
@ -132,8 +134,10 @@ namespace Mist{
|
|||
/* ------------------------------------------------ */
|
||||
|
||||
OutWebRTC::OutWebRTC(Socket::Connection &myConn) : HTTPOutput(myConn){
|
||||
#ifdef WITH_DATACHANNELS
|
||||
sctpInited = false;
|
||||
sctpConnected = false;
|
||||
#endif
|
||||
noSignalling = false;
|
||||
totalPkts = 0;
|
||||
totalLoss = 0;
|
||||
|
@ -1170,6 +1174,7 @@ namespace Mist{
|
|||
|
||||
if (wSock.udpSock->data.size() && wSock.udpSock->wasEncrypted){
|
||||
lastRecv = Util::bootMS();
|
||||
#ifdef WITH_DATACHANNELS
|
||||
if (packetLog.is_open()){
|
||||
packetLog << "[" << Util::bootMS() << "]" << "SCTP packet (" << wSock.udpSock->data.size() << "b): " << std::endl;
|
||||
char * buffer = usrsctp_dumppacket(wSock.udpSock->data, wSock.udpSock->data.size(), SCTP_DUMP_INBOUND);
|
||||
|
@ -1200,6 +1205,7 @@ namespace Mist{
|
|||
}
|
||||
usrsctp_conninput(this, wSock.udpSock->data, wSock.udpSock->data.size(), 0);
|
||||
//usrsctp_accept(sctp_sock, 0, 0);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1636,6 +1642,7 @@ namespace Mist{
|
|||
}
|
||||
|
||||
void OutWebRTC::onSCTP(const char * data, size_t len, uint16_t stream, uint32_t ppid){
|
||||
#ifdef WITH_DATACHANNELS
|
||||
if (!sctpConnected){
|
||||
// We have to call accept (at least) once, otherwise the SCTP library considers our socket not connected
|
||||
// Accept blocks if there is no peer, so we do this as soon as the first message is received, which means we have a peer.
|
||||
|
@ -1723,6 +1730,7 @@ namespace Mist{
|
|||
packetLog << std::dec << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void OutWebRTC::onDTSCConverterHasPacket(const DTSC::Packet &pkt){
|
||||
|
@ -1894,6 +1902,7 @@ namespace Mist{
|
|||
|
||||
|
||||
if (M.getType(thisIdx) == "meta"){
|
||||
#ifdef WITH_DATACHANNELS
|
||||
JSON::Value jPack;
|
||||
if (M.getCodec(thisIdx) == "JSON"){
|
||||
if (dataLen == 0 || (dataLen == 1 && dataPointer[0] == ' ')){return;}
|
||||
|
@ -1938,6 +1947,7 @@ namespace Mist{
|
|||
WARN_MSG("I don't have a data channel for %s data!", M.getCodec(thisIdx).c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
#include <mist/websocket.h>
|
||||
#include <fstream>
|
||||
#include "output_webrtc_srtp.h"
|
||||
#include <usrsctp.h>
|
||||
|
||||
#ifdef WITH_DATACHANNELS
|
||||
#include <usrsctp.h>
|
||||
#endif
|
||||
|
||||
#define NACK_BUFFER_SIZE 1024
|
||||
|
||||
|
@ -206,11 +209,13 @@ namespace Mist{
|
|||
int64_t ntpClockDifference;
|
||||
bool syncedNTPClock;
|
||||
|
||||
#ifdef WITH_DATACHANNELS
|
||||
bool sctpInited;
|
||||
bool sctpConnected;
|
||||
struct socket * sctp_sock;
|
||||
std::map<std::string, uint16_t> dataChannels;
|
||||
std::deque<std::string> queuedJSON;
|
||||
#endif
|
||||
};
|
||||
}// namespace Mist
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue