Commit 67b6f719 authored by Simon Morlat's avatar Simon Morlat

Fix no audio issue - because StunClient was corrupting localMediaDescription...

Fix no audio issue - because StunClient was corrupting localMediaDescription when no STUN discovery was actually made.
parent 3f916b19
......@@ -930,6 +930,7 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
return 1;
}
linphone_core_set_firewall_policy(lc,LinphonePolicyUseNatAddress);
setting = linphone_core_get_nat_address(lc);
}
}
......
......@@ -30,6 +30,7 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
int StunClient::run (int audioPort, int videoPort, int textPort) {
stunDiscoveryDone = false;
if (linphone_core_ipv6_enabled(getCore()->getCCore())) {
lWarning() << "STUN support is not implemented for ipv6";
return -1;
......@@ -139,10 +140,12 @@ int StunClient::run (int audioPort, int videoPort, int textPort) {
close_socket(sockAudio);
if (sockVideo != -1) close_socket(sockVideo);
if (sockText != -1) close_socket(sockText);
stunDiscoveryDone = true;
return ret;
}
void StunClient::updateMediaDescription (SalMediaDescription *md) const {
if (!stunDiscoveryDone) return;
for (int i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (!sal_stream_description_active(&md->streams[i]))
continue;
......
......@@ -38,7 +38,7 @@ LINPHONE_BEGIN_NAMESPACE
class StunClient : public CoreAccessor {
struct Candidate {
std::string address;
int port;
int port = 0;
};
public:
......@@ -67,6 +67,7 @@ private:
Candidate audioCandidate;
Candidate videoCandidate;
Candidate textCandidate;
bool stunDiscoveryDone = false;
};
LINPHONE_END_NAMESPACE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment