1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge remote-tracking branch 'john/rtc' into feature/rtc

This commit is contained in:
winlin 2020-04-03 15:17:13 +08:00
commit 0ff3ce7464
4 changed files with 64 additions and 10 deletions

View file

@ -89,6 +89,9 @@ SrsStunPacket::SrsStunPacket()
message_type = 0;
local_ufrag = "";
remote_ufrag = "";
use_candidate = false;
ice_controlled = false;
ice_controlling = false;
}
SrsStunPacket::~SrsStunPacket()
@ -140,8 +143,32 @@ srs_error_t SrsStunPacket::decode(const char* buf, const int nb_buf)
}
break;
}
case UseCandidate: {
use_candidate = true;
srs_verbose("stun use-candidate");
break;
}
// @see: https://tools.ietf.org/html/draft-ietf-ice-rfc5245bis-00#section-5.1.2
// One agent full, one lite: The full agent MUST take the controlling
// role, and the lite agent MUST take the controlled role. The full
// agent will form check lists, run the ICE state machines, and
// generate connectivity checks.
case IceControlled: {
ice_controlled = true;
srs_verbose("stun ice-controlled");
break;
}
case IceControlling: {
ice_controlling = true;
srs_verbose("stun ice-controlling");
break;
}
default: {
srs_verbose("stun type=%u, no process", type);
break;
}
}

View file

@ -69,6 +69,11 @@ enum SrsStunMessageAttribute
Software = 0x8022,
AlternateServer = 0x8023,
Fingerprint = 0x8028,
Priority = 0x0024,
UseCandidate = 0x0025,
IceControlled = 0x8029,
IceControlling = 0x802A,
};
class SrsStunPacket
@ -81,6 +86,9 @@ private:
std::string transcation_id;
uint32_t mapped_address;
uint16_t mapped_port;
bool use_candidate;
bool ice_controlled;
bool ice_controlling;
public:
SrsStunPacket();
virtual ~SrsStunPacket();
@ -95,6 +103,9 @@ public:
std::string get_transcation_id() const { return transcation_id; }
uint32_t get_mapped_address() const { return mapped_address; }
uint16_t get_mapped_port() const { return mapped_port; }
bool get_ice_controlled() const { return ice_controlled; }
bool get_ice_controlling() const { return ice_controlling; }
bool get_use_candidate() const { return use_candidate; }
void set_message_type(const uint16_t& m) { message_type = m; }
void set_local_ufrag(const std::string& u) { local_ufrag = u; }