WebRTC edits for code acceptance
This commit is contained in:
parent
7e8eb634e6
commit
e4471627ca
4 changed files with 396 additions and 478 deletions
|
@ -1097,13 +1097,13 @@ namespace SDP{
|
||||||
for (size_t j = 0; j < formats.size(); ++j){
|
for (size_t j = 0; j < formats.size(); ++j){
|
||||||
if (codec == "H264"){
|
if (codec == "H264"){
|
||||||
if (formats[j]->getPacketizationModeForH264() != 1){
|
if (formats[j]->getPacketizationModeForH264() != 1){
|
||||||
FAIL_MSG(
|
MEDIUM_MSG(
|
||||||
"Skipping this H264 format because it uses a packetization mode we don't support.");
|
"Skipping this H264 format because it uses a packetization mode we don't support.");
|
||||||
format = NULL;
|
format = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (formats[j]->getProfileLevelIdForH264() != "42e01f") {
|
if (formats[j]->getProfileLevelIdForH264() != "42e01f") {
|
||||||
FAIL_MSG("Skipping this H264 format because it uses an unsupported profile-level-id.");
|
MEDIUM_MSG("Skipping this H264 format because it uses an unsupported profile-level-id.");
|
||||||
format = NULL;
|
format = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,6 @@ export PATH="${PATH}:${d}/installed/include"
|
||||||
cmake -DCMAKE_CXX_FLAGS="-I${d}/installed/include/ -L${d}/installed/lib/" \
|
cmake -DCMAKE_CXX_FLAGS="-I${d}/installed/include/ -L${d}/installed/lib/" \
|
||||||
-DCMAKE_PREFIX_PATH=${d}/installed/include \
|
-DCMAKE_PREFIX_PATH=${d}/installed/include \
|
||||||
-DCMAKE_MODULE_PATH=${d}/installed/ \
|
-DCMAKE_MODULE_PATH=${d}/installed/ \
|
||||||
-DPERPETUAL=1 \
|
|
||||||
-DDEBUG=3 \
|
|
||||||
-GNinja \
|
-GNinja \
|
||||||
.
|
.
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -68,6 +68,8 @@
|
||||||
#include <mist/dtls_srtp_handshake.h>
|
#include <mist/dtls_srtp_handshake.h>
|
||||||
#include <mist/srtp.h>
|
#include <mist/srtp.h>
|
||||||
|
|
||||||
|
#define NACK_BUFFER_SIZE 1024
|
||||||
|
|
||||||
#if defined(WEBRTC_PCAP)
|
#if defined(WEBRTC_PCAP)
|
||||||
# include <mist/pcap.h>
|
# include <mist/pcap.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -76,6 +78,26 @@ namespace Mist {
|
||||||
|
|
||||||
/* ------------------------------------------------ */
|
/* ------------------------------------------------ */
|
||||||
|
|
||||||
|
class nackBuffer{
|
||||||
|
public:
|
||||||
|
bool isBuffered(uint16_t seq){
|
||||||
|
if (!bufs[seq%NACK_BUFFER_SIZE].size()){return false;}
|
||||||
|
RTP::Packet tmpPkt(bufs[seq%NACK_BUFFER_SIZE], bufs[seq%NACK_BUFFER_SIZE].size());
|
||||||
|
return (tmpPkt.getSequence() == seq);
|
||||||
|
}
|
||||||
|
const char * getData(uint16_t seq){
|
||||||
|
return bufs[seq % NACK_BUFFER_SIZE];
|
||||||
|
}
|
||||||
|
size_t getSize(uint16_t seq){
|
||||||
|
return bufs[seq % NACK_BUFFER_SIZE].size();
|
||||||
|
}
|
||||||
|
void assign(uint16_t seq, const char * p, size_t s){
|
||||||
|
bufs[seq % NACK_BUFFER_SIZE].assign(p, s);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
Util::ResizeablePointer bufs[NACK_BUFFER_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
class WebRTCTrack {
|
class WebRTCTrack {
|
||||||
public:
|
public:
|
||||||
WebRTCTrack(); ///< Initializes to some defaults.
|
WebRTCTrack(); ///< Initializes to some defaults.
|
||||||
|
@ -105,6 +127,9 @@ namespace Mist {
|
||||||
virtual void sendHeader();
|
virtual void sendHeader();
|
||||||
virtual void sendNext();
|
virtual void sendNext();
|
||||||
virtual void onWebsocketFrame();
|
virtual void onWebsocketFrame();
|
||||||
|
virtual void preWebsocketConnect();
|
||||||
|
void onIdle();
|
||||||
|
bool onFinish();
|
||||||
bool doesWebsockets(){return true;}
|
bool doesWebsockets(){return true;}
|
||||||
void handleWebRTCInputOutputFromThread();
|
void handleWebRTCInputOutputFromThread();
|
||||||
int onDTLSHandshakeWantsToWrite(const uint8_t* data, int* nbytes);
|
int onDTLSHandshakeWantsToWrite(const uint8_t* data, int* nbytes);
|
||||||
|
@ -115,19 +140,15 @@ namespace Mist {
|
||||||
void onRTPPacketizerHasRTCPPacket(char* data, uint32_t nbytes);
|
void onRTPPacketizerHasRTCPPacket(char* data, uint32_t nbytes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string externalAddr;
|
||||||
|
void ackNACK(uint32_t SSRC, uint16_t seq);
|
||||||
bool handleWebRTCInputOutput(); ///< Reads data from the UDP socket. Returns true when we read some data, othewise false.
|
bool handleWebRTCInputOutput(); ///< Reads data from the UDP socket. Returns true when we read some data, othewise false.
|
||||||
void handleReceivedSTUNPacket();
|
void handleReceivedSTUNPacket();
|
||||||
void handleReceivedDTLSPacket();
|
void handleReceivedDTLSPacket();
|
||||||
void handleReceivedRTPOrRTCPPacket();
|
void handleReceivedRTPOrRTCPPacket();
|
||||||
void handleSignalingCommand(HTTP::Websocket& webSock, const JSON::Value &command);
|
bool handleSignalingCommandRemoteOfferForInput(SDP::Session &sdpSession);
|
||||||
bool handleSignalingCommandRemoteOffer(HTTP::Websocket &webSock, const JSON::Value &command);
|
bool handleSignalingCommandRemoteOfferForOutput(SDP::Session &sdpSession);
|
||||||
bool handleSignalingCommandRemoteOfferForInput(HTTP::Websocket &webSocket, SDP::Session &sdpSession, const std::string &sdpOffer);
|
void sendSignalingError(const std::string& commandType, const std::string& errorMessage);
|
||||||
bool handleSignalingCommandRemoteOfferForOutput(HTTP::Websocket &webSocket, SDP::Session &sdpSession, const std::string &sdpOffer);
|
|
||||||
bool handleSignalingCommandVideoBitrate(HTTP::Websocket& webSock, const JSON::Value &command);
|
|
||||||
bool handleSignalingCommandSeek(HTTP::Websocket& webSock, const JSON::Value &command);
|
|
||||||
bool handleSignalingCommandKeyFrameInterval(HTTP::Websocket &webSock, const JSON::Value &command); ///< Handles the command that can be used to set the keyframe interval for the current connection. We will sent RTCP PLI messages every X-millis; the other agent -should- generate keyframes when it receives PLI messages (Picture Loss Indication).
|
|
||||||
void sendSignalingError(HTTP::Websocket& webSock, const std::string& commandType, const std::string& errorMessage);
|
|
||||||
bool validateSignalingCommand(HTTP::Websocket& webSock, const JSON::Value &command, JSON::Value &errorResult);
|
|
||||||
|
|
||||||
bool createWebRTCTrackFromAnswer(const SDP::Media& mediaAnswer, const SDP::MediaFormat& formatAnswer, WebRTCTrack& result);
|
bool createWebRTCTrackFromAnswer(const SDP::Media& mediaAnswer, const SDP::MediaFormat& formatAnswer, WebRTCTrack& result);
|
||||||
void sendRTCPFeedbackREMB(const WebRTCTrack &rtcTrack);
|
void sendRTCPFeedbackREMB(const WebRTCTrack &rtcTrack);
|
||||||
|
@ -156,9 +177,11 @@ namespace Mist {
|
||||||
uint64_t rtcpTimeoutInMillis; ///< When current time in millis exceeds this timeout we have to send a new RTCP packet.
|
uint64_t rtcpTimeoutInMillis; ///< When current time in millis exceeds this timeout we have to send a new RTCP packet.
|
||||||
uint64_t rtcpKeyFrameTimeoutInMillis;
|
uint64_t rtcpKeyFrameTimeoutInMillis;
|
||||||
uint64_t rtcpKeyFrameDelayInMillis;
|
uint64_t rtcpKeyFrameDelayInMillis;
|
||||||
char* rtpOutBuffer; ///< Buffer into which we copy (unprotected) RTP data that we need to deliver to the other peer. This gets protected.
|
Util::ResizeablePointer rtpOutBuffer; ///< Buffer into which we copy (unprotected) RTP data that we need to deliver to the other peer. This gets protected.
|
||||||
uint32_t videoBitrate; ///< The bitrate to use for incoming video streams. Can be configured via the signaling channel. Defaults to 6mbit.
|
uint32_t videoBitrate; ///< The bitrate to use for incoming video streams. Can be configured via the signaling channel. Defaults to 6mbit.
|
||||||
|
|
||||||
|
uint32_t audTrack, vidTrack;
|
||||||
|
|
||||||
bool didReceiveKeyFrame; /* TODO burst delay */
|
bool didReceiveKeyFrame; /* TODO burst delay */
|
||||||
|
|
||||||
#if defined(WEBRTC_PCAP)
|
#if defined(WEBRTC_PCAP)
|
||||||
|
@ -167,6 +190,7 @@ namespace Mist {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::map<uint8_t, uint64_t> payloadTypeToWebRTCTrack; ///< Maps e.g. RED to the corresponding track. Used when input supports RED/ULPFEC; can also be used to map RTX in the future.
|
std::map<uint8_t, uint64_t> payloadTypeToWebRTCTrack; ///< Maps e.g. RED to the corresponding track. Used when input supports RED/ULPFEC; can also be used to map RTX in the future.
|
||||||
|
std::map<uint32_t, nackBuffer> outBuffers;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue