Commit e75404cb authored by Ronan's avatar Ronan

fix(core): fix coding style on many files, remove useless includes...

parent 113dee4b
......@@ -136,6 +136,13 @@ inline const Object *getPublicHelper (const T *object, const ObjectPrivate *) {
return *this; \
}
// -----------------------------------------------------------------------------
// Wrapper public.
// -----------------------------------------------------------------------------
#define L_DECL_C_STRUCT(STRUCT) typedef struct _ ## STRUCT STRUCT;
#define L_DECL_C_STRUCT_PREFIX_LESS(STRUCT) typedef struct STRUCT STRUCT;
#endif
LINPHONE_END_NAMESPACE
......
......@@ -56,4 +56,4 @@ private:
LINPHONE_END_NAMESPACE
#endif
#endif // ifndef _ADDRESS_P_H_
......@@ -17,14 +17,11 @@
*/
#include "linphone/utils/utils.h"
#include "sal/sal.h"
#include "address-p.h"
#include "c-wrapper/c-wrapper.h"
#include "logger/logger.h"
#include "address.h"
// =============================================================================
using namespace std;
......
......@@ -19,8 +19,6 @@
#ifndef _ADDRESS_H_
#define _ADDRESS_H_
#include <string>
#include "enums.h"
#include "object/clonable-object.h"
......
......@@ -19,12 +19,9 @@
#ifndef _CALL_P_H_
#define _CALL_P_H_
#include <memory>
#include "object/object-p.h"
#include "call.h"
#include "conference/conference.h"
#include "object/object-p.h"
#include "private.h"
......@@ -70,7 +67,6 @@ private:
void onFirstVideoFrameDecoded () override;
void onResetFirstVideoFrameDecoded () override;
private:
LinphoneCall *lcall = nullptr;
LinphoneCore *core = nullptr;
......
......@@ -17,23 +17,20 @@
*/
#include "call-p.h"
#include "conference/local-conference.h"
#include "conference/participant-p.h"
#include "conference/remote-conference.h"
#include "conference/session/media-session-p.h"
#include "logger/logger.h"
#include "call.h"
#include "conference/local-conference.h"
#include "conference/remote-conference.h"
#include "conference/session/media-session.h"
#include "logger/logger.h"
#include "private.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
// =============================================================================
CallPrivate::CallPrivate (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to,
LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp) : lcall(call), core(core) {
nextVideoFrameDecoded._func = nullptr;
......
......@@ -19,12 +19,9 @@
#ifndef _CALL_CALL_H_
#define _CALL_CALL_H_
#include "linphone/types.h"
#include "object/object.h"
#include "address/address.h"
#include "call/call-listener.h"
#include "conference/params/media-session-params.h"
#include "object/object.h"
// =============================================================================
......@@ -39,8 +36,16 @@ class Call : public Object {
friend class MediaSessionPrivate;
public:
Call (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to,
LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp);
Call (
LinphoneCall *call,
LinphoneCore *core,
LinphoneCallDir direction,
const Address &from,
const Address &to,
LinphoneProxyConfig *cfg,
SalOp *op,
const MediaSessionParams *msp
);
LinphoneStatus accept (const MediaSessionParams *msp = nullptr);
LinphoneStatus acceptEarlyMedia (const MediaSessionParams *msp = nullptr);
......@@ -52,8 +57,8 @@ public:
void sendVfuRequest ();
void startRecording ();
void stopRecording ();
LinphoneStatus takePreviewSnapshot (const std::string& file);
LinphoneStatus takeVideoSnapshot (const std::string& file);
LinphoneStatus takePreviewSnapshot (const std::string &file);
LinphoneStatus takeVideoSnapshot (const std::string &file);
LinphoneStatus terminate (const LinphoneErrorInfo *ei = nullptr);
LinphoneStatus update (const MediaSessionParams *msp = nullptr);
void zoomVideo (float zoomFactor, float *cx, float *cy);
......@@ -65,36 +70,36 @@ public:
void enableEchoCancellation (bool value);
void enableEchoLimiter (bool value);
bool getAllMuted () const;
LinphoneCallStats * getAudioStats () const;
LinphoneCallStats *getAudioStats () const;
std::string getAuthenticationToken () const;
bool getAuthenticationTokenVerified () const;
float getAverageQuality () const;
LinphoneCore * getCore () const;
const MediaSessionParams * getCurrentParams () const;
LinphoneCore *getCore () const;
const MediaSessionParams *getCurrentParams () const;
float getCurrentQuality () const;
LinphoneCallDir getDirection () const;
int getDuration () const;
const LinphoneErrorInfo * getErrorInfo () const;
LinphoneCallLog * getLog () const;
RtpTransport * getMetaRtcpTransport (int streamIndex) const;
RtpTransport * getMetaRtpTransport (int streamIndex) const;
const LinphoneErrorInfo *getErrorInfo () const;
LinphoneCallLog *getLog () const;
RtpTransport *getMetaRtcpTransport (int streamIndex) const;
RtpTransport *getMetaRtpTransport (int streamIndex) const;
float getMicrophoneVolumeGain () const;
void * getNativeVideoWindowId () const;
const MediaSessionParams * getParams () const;
void *getNativeVideoWindowId () const;
const MediaSessionParams *getParams () const;
float getPlayVolume () const;
LinphoneReason getReason () const;
float getRecordVolume () const;
const Address& getRemoteAddress () const;
const Address &getRemoteAddress () const;
std::string getRemoteAddressAsString () const;
std::string getRemoteContact () const;
const MediaSessionParams * getRemoteParams () const;
const MediaSessionParams *getRemoteParams () const;
float getSpeakerVolumeGain () const;
LinphoneCallState getState () const;
LinphoneCallStats * getStats (LinphoneStreamType type) const;
LinphoneCallStats *getStats (LinphoneStreamType type) const;
int getStreamCount () const;
MSFormatType getStreamType (int streamIndex) const;
LinphoneCallStats * getTextStats () const;
LinphoneCallStats * getVideoStats () const;
LinphoneCallStats *getTextStats () const;
LinphoneCallStats *getVideoStats () const;
bool mediaInProgress () const;
void setAuthenticationTokenVerified (bool value);
void setMicrophoneVolumeGain (float value);
......
......@@ -19,8 +19,6 @@
#ifndef _CALL_SESSION_P_H_
#define _CALL_SESSION_P_H_
#include <memory>
#include "object/object-p.h"
#include "call-session.h"
......
......@@ -29,9 +29,6 @@
#include "nat/stun-client.h"
#include "linphone/call_stats.h"
#include "sal/sal.h"
#include "private.h"
// =============================================================================
......@@ -63,30 +60,53 @@ public:
void prepareStreamsForIceGathering (bool hasVideo);
void stopStreamsForIceGathering ();
int getAf () const { return af; }
bool getAudioMuted () const { return audioMuted; }
LinphoneCore * getCore () const { return core; }
IceSession * getIceSession () const { return iceAgent->getIceSession(); }
SalMediaDescription * getLocalDesc () const { return localDesc; }
MediaStream * getMediaStream (LinphoneStreamType type) const;
LinphoneNatPolicy * getNatPolicy () const { return natPolicy; }
int getAf () const {
return af;
}
bool getAudioMuted () const {
return audioMuted;
}
LinphoneCore *getCore () const {
return core;
}
IceSession *getIceSession () const {
return iceAgent->getIceSession();
}
SalMediaDescription *getLocalDesc () const {
return localDesc;
}
MediaStream *getMediaStream (LinphoneStreamType type) const;
LinphoneNatPolicy *getNatPolicy () const {
return natPolicy;
}
int getRtcpPort (LinphoneStreamType type) const;
int getRtpPort (LinphoneStreamType type) const;
LinphoneCallStats * getStats (LinphoneStreamType type) const;
LinphoneCallStats *getStats (LinphoneStreamType type) const;
int getStreamIndex (LinphoneStreamType type) const;
int getStreamIndex (MediaStream *ms) const;
SalOp * getOp () const { return op; }
void setAudioMuted (bool value) { audioMuted = value; }
SalOp *getOp () const {
return op;
}
void setAudioMuted (bool value) {
audioMuted = value;
}
private:
static OrtpJitterBufferAlgorithm jitterBufferNameToAlgo (const std::string &name);
#ifdef VIDEO_ENABLED
static void videoStreamEventCb (void *userData, const MSFilter *f, const unsigned int eventId, const void *args);
#endif
#ifdef TEST_EXT_RENDERER
static void extRendererCb (void *userData, const MSPicture *local, const MSPicture *remote);
#endif
#ifdef VIDEO_ENABLED
static void videoStreamEventCb (void *userData, const MSFilter *f, const unsigned int eventId, const void *args);
#endif // ifdef VIDEO_ENABLED
#ifdef TEST_EXT_RENDERER
static void extRendererCb (void *userData, const MSPicture *local, const MSPicture *remote);
#endif // ifdef TEST_EXT_RENDERER
static void realTimeTextCharacterReceived (void *userData, MSFilter *f, unsigned int id, void *arg);
static float aggregateQualityRatings (float audioRating, float videoRating);
......@@ -103,9 +123,9 @@ private:
void initStats (LinphoneCallStats *stats, LinphoneStreamType type);
void notifyStatsUpdated (int streamIndex) const;
OrtpEvQueue * getEventQueue (int streamIndex) const;
MediaStream * getMediaStream (int streamIndex) const;
MSWebCam * getVideoDevice () const;
OrtpEvQueue *getEventQueue (int streamIndex) const;
MediaStream *getMediaStream (int streamIndex) const;
MSWebCam *getVideoDevice () const;
void fillMulticastMediaAddresses ();
int selectFixedPort (int streamIndex, std::pair<int, int> portRange);
......@@ -149,7 +169,7 @@ private:
int getIdealAudioBandwidth (const SalMediaDescription *md, const SalStreamDescription *desc);
int getVideoBandwidth (const SalMediaDescription *md, const SalStreamDescription *desc);
RtpProfile * makeProfile (const SalMediaDescription *md, const SalStreamDescription *desc, int *usedPt);
RtpProfile *makeProfile (const SalMediaDescription *md, const SalStreamDescription *desc, int *usedPt);
void unsetRtpProfile (int streamIndex);
void updateAllocatedAudioBandwidth (const PayloadType *pt, int maxbw);
......@@ -159,8 +179,8 @@ private:
void configureAdaptiveRateControl (MediaStream *ms, const OrtpPayloadType *pt, bool videoWillBeUsed);
void configureRtpSessionForRtcpFb (const SalStreamDescription *stream);
void configureRtpSessionForRtcpXr (SalStreamType type);
RtpSession * createAudioRtpIoSession ();
RtpSession * createVideoRtpIoSession ();
RtpSession *createAudioRtpIoSession ();
RtpSession *createVideoRtpIoSession ();
void freeResources ();
void handleIceEvents (OrtpEvent *ev);
void handleStreamEvents (int streamIndex);
......@@ -224,9 +244,9 @@ private:
void accept (const MediaSessionParams *params);
LinphoneStatus acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const std::string &stateInfo) override;
#ifdef VIDEO_ENABLED
void videoStreamEventCb (const MSFilter *f, const unsigned int eventId, const void *args);
#endif
#ifdef VIDEO_ENABLED
void videoStreamEventCb (const MSFilter *f, const unsigned int eventId, const void *args);
#endif // ifdef VIDEO_ENABLED
void realTimeTextCharacterReceived (MSFilter *f, unsigned int id, void *arg);
void stunAuthRequestedCb (const char *realm, const char *nonce, const char **username, const char **password, const char **ha1);
......@@ -265,11 +285,16 @@ private:
StunClient *stunClient = nullptr;
IceAgent *iceAgent = nullptr;
int af; /* The address family to prefer for RTP path, guessed from signaling path */
// The address family to prefer for RTP path, guessed from signaling path.
int af;
std::string mediaLocalIp;
PortConfig mediaPorts[SAL_MEDIA_DESCRIPTION_MAX_STREAMS];
bool needMediaLocalIpRefresh = false;
MSMediaStreamSessions sessions[SAL_MEDIA_DESCRIPTION_MAX_STREAMS]; /* The rtp, srtp, zrtp contexts for each stream */
// The rtp, srtp, zrtp contexts for each stream.
MSMediaStreamSessions sessions[SAL_MEDIA_DESCRIPTION_MAX_STREAMS];
SalMediaDescription *localDesc = nullptr;
int localDescChanged = 0;
SalMediaDescription *biggestDesc = nullptr;
......@@ -283,8 +308,12 @@ private:
std::string dtlsCertificateFingerprint;
unsigned int nbMediaStarts = 0;
int upBandwidth = 0; /* Upload bandwidth setting at the time the call is started. Used to detect if it changes during a call */
int audioBandwidth = 0; /* Upload bandwidth used by audio */
// Upload bandwidth setting at the time the call is started. Used to detect if it changes during a call.
int upBandwidth = 0;
// Upload bandwidth used by audio.
int audioBandwidth = 0;
bool allMuted = false;
bool audioMuted = false;
......
......@@ -19,8 +19,6 @@
#ifndef _CONTENT_TYPE_H_
#define _CONTENT_TYPE_H_
#include <string>
#include "object/clonable-object.h"
// =============================================================================
......
......@@ -19,11 +19,9 @@
#ifndef _CONTENT_H_
#define _CONTENT_H_
#include <string>
#include <vector>
#include "content-type.h"
#include "object/clonable-object.h"
// =============================================================================
......
......@@ -20,8 +20,6 @@
#include "db/provider/db-session-provider.h"
#include "logger/logger.h"
#include "abstract-db.h"
// =============================================================================
using namespace std;
......
......@@ -42,12 +42,12 @@ class EventsDbPrivate : public AbstractDbPrivate {};
EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
#ifdef SOCI_ENABLED
// -----------------------------------------------------------------------------
// Soci backend.
// -----------------------------------------------------------------------------
#ifdef SOCI_ENABLED
template<typename T>
struct EnumToSql {
T first;
......@@ -169,10 +169,18 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
*session <<
"CREATE TABLE IF NOT EXISTS dialog ("
" id" + primaryKeyAutoIncrementStr() + ","
" local_sip_address_id INT UNSIGNED NOT NULL," // Sip address used to communicate.
" remote_sip_address_id INT UNSIGNED NOT NULL," // Server (for conference) or user sip address.
" creation_timestamp TIMESTAMP NOT NULL," // Dialog creation date.
" last_update_timestamp TIMESTAMP NOT NULL," // Last event timestamp (call, message...).
// Sip address used to communicate.
" local_sip_address_id INT UNSIGNED NOT NULL,"
// Server (for conference) or user sip address.
" remote_sip_address_id INT UNSIGNED NOT NULL,"
// Dialog creation date.
" creation_timestamp TIMESTAMP NOT NULL,"
// Last event timestamp (call, message...).
" last_update_timestamp TIMESTAMP NOT NULL,"
" FOREIGN KEY (local_sip_address_id)"
" REFERENCES sip_address(id)"
" ON DELETE CASCADE,"
......@@ -189,11 +197,19 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
" state_id TINYINT UNSIGNED NOT NULL,"
" direction_id TINYINT UNSIGNED NOT NULL,"
" sender_sip_address_id INT UNSIGNED NOT NULL,"
" imdn_message_id VARCHAR(255) NOT NULL," // See: https://tools.ietf.org/html/rfc5438#section-6.3
// See: https://tools.ietf.org/html/rfc5438#section-6.3
" imdn_message_id VARCHAR(255) NOT NULL,"
" is_secured BOOLEAN NOT NULL,"
" content_type VARCHAR(255) NOT NULL," // Content type of text. (Html or text for example.)
// Content type of text. (Html or text for example.)
" content_type VARCHAR(255) NOT NULL,"
" text TEXT,"
" app_data VARCHAR(2048)," // App user data.
// App user data.
" app_data VARCHAR(2048),"
" FOREIGN KEY (event_id)"
" REFERENCES event(id)"
" ON DELETE CASCADE,"
......@@ -215,10 +231,18 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
"CREATE TABLE IF NOT EXISTS message_file_info ("
" id" + primaryKeyAutoIncrementStr() + ","
" message_id INT UNSIGNED NOT NULL,"
" content_type VARCHAR(255) NOT NULL," // File content type.
" name VARCHAR(255) NOT NULL," // File name.
" size INT UNSIGNED NOT NULL," // File size.
" url VARCHAR(255) NOT NULL," // File url.
// File content type.
" content_type VARCHAR(255) NOT NULL,"
// File name.
" name VARCHAR(255) NOT NULL,"
// File size.
" size INT UNSIGNED NOT NULL,"
// File url.
" url VARCHAR(255) NOT NULL,"
" key VARCHAR(4096),"
" key_size INT UNSIGNED,"
" FOREIGN KEY (message_id)"
......
......@@ -20,7 +20,6 @@
#define _EVENTS_DB_H_
#include <list>
#include <memory>
#include "abstract/abstract-db.h"
......@@ -53,8 +52,17 @@ public:
// Messages, calls and conferences.
int getMessagesCount (const std::string &remoteAddress = "") const;
int getUnreadMessagesCount (const std::string &remoteAddress = "") const;
std::list<std::shared_ptr<EventLog> > getHistory (const std::string &remoteAddress, int nLast, FilterMask mask = NoFilter) const;
std::list<std::shared_ptr<EventLog> > getHistory (const std::string &remoteAddress, int begin, int end, FilterMask mask = NoFilter) const;
std::list<std::shared_ptr<EventLog>> getHistory (
const std::string &remoteAddress,
int nLast,
FilterMask mask = NoFilter
) const;
std::list<std::shared_ptr<EventLog>> getHistory (
const std::string &remoteAddress,
int begin,
int end,
FilterMask mask = NoFilter
) const;
void cleanHistory (const std::string &remoteAddress = "");
protected:
......
......@@ -28,8 +28,6 @@
LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
class DbSessionPrivate : public ClonableObjectPrivate {
friend class DbSessionProvider;
......
......@@ -18,8 +18,6 @@
#include "db-session-p.h"
#include "db-session.h"
// =============================================================================
using namespace std;
......
......@@ -16,9 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "event-log-p.h"
#include "call-event.h"
#include "event-log-p.h"
// =============================================================================
......
......@@ -16,9 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "event-log-p.h"
#include "chat-message-event.h"
#include "event-log-p.h"
// =============================================================================
......@@ -45,7 +44,7 @@ ChatMessageEvent::ChatMessageEvent (const ChatMessageEvent &src) : ChatMessageEv
ChatMessageEvent &ChatMessageEvent::operator= (const ChatMessageEvent &src) {
L_D(ChatMessageEvent);
if (this != &src) {
EventLog::operator= (src);
EventLog::operator=(src);
d->chatMessage = src.getPrivate()->chatMessage;
}
......
......@@ -21,7 +21,6 @@
#include "address/address.h"
#include "conference-event.h"
#include "event-log-p.h"
// =============================================================================
......
......@@ -19,8 +19,6 @@
#include "address/address.h"
#include "conference-event-p.h"
#include "conference-event.h"
// =============================================================================
using namespace std;
......
......@@ -18,7 +18,6 @@
#include "address/address.h"
#include "conference-event-p.h"
#include "conference-participant-event.h"
// =============================================================================
......
......@@ -18,14 +18,10 @@
#include "event-log-p.h"
#include "event-log.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
EventLog::EventLog () : ClonableObject(*new EventLogPrivate) {}
EventLog::EventLog (const EventLog &) : ClonableObject(*new EventLogPrivate) {}
......
This diff is collapsed.
......@@ -22,14 +22,18 @@
#include <mediastreamer2/ice.h>
#include <ortp/event.h>
#include "linphone/types.h"
#include "linphone/utils/general.h"
#include "sal/sal.h"
#include "conference/session/media-session.h"
// =============================================================================
L_DECL_C_STRUCT_PREFIX_LESS(SalMediaDescription);
L_DECL_C_STRUCT_PREFIX_LESS(SalStreamDescription);
L_DECL_C_STRUCT(LinphoneCallStats);
L_DECL_C_STRUCT(LinphoneCore);
L_DECL_C_STRUCT(MediaStream);
class MediaSession;
LINPHONE_BEGIN_NAMESPACE
class IceAgent {
......@@ -41,10 +45,16 @@ public:
void deleteSession ();
void gatheringFinished ();
int getNbLosingPairs () const;
IceSession * getIceSession () const { return iceSession; }
IceSession *getIceSession () const {
return iceSession;
}
bool hasCompleted () const;
bool hasCompletedCheckList () const;
bool hasSession () const { return iceSession; }
bool hasSession () const {
return iceSession;
}
bool isControlling () const;
bool prepare (const SalMediaDescription *localDesc, bool incomingOffer);
void prepareIceForStream (MediaStream *ms, bool createChecklist);
......@@ -62,7 +72,7 @@ private:
void createIceCheckListsAndParseIceAttributes (const SalMediaDescription *md, bool iceRestarted);
int gatherIceCandidates ();
void getIceDefaultAddrAndPort (uint16_t componentID, const SalMediaDescription *md, const SalStreamDescription *stream, const char **addr, int *port);
const struct addrinfo * getIcePreferredStunServerAddrinfo (const struct addrinfo *ai);
const struct addrinfo *getIcePreferredStunServerAddrinfo (const struct addrinfo *ai);
bool iceParamsFoundInRemoteMediaDescription (const SalMediaDescription *md);
void updateIceStateInCallStatsForStream (LinphoneCallStats *stats, IceCheckList *cl);
......
......@@ -16,8 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "linphone/core.h"
#include "private.h"
#include "logger/logger.h"
......@@ -113,31 +111,28 @@ int StunClient::run (int audioPort, int videoPort, int textPort) {
break;
}
loops++;
} while (!(gotAudio && (gotVideo || (sockVideo == -1)) && (gotText || (sockText == -1))));
} while (!(gotAudio && (gotVideo || sockVideo == -1) && (gotText || sockText == -1)));
if (ret == 0)
ret = (int)elapsed;
if (!gotAudio)
lError() << "No STUN server response for audio port";
else {
if (!coneAudio)
lInfo() << "NAT is symmetric for audio port";
}
else if (!coneAudio)
lInfo() << "NAT is symmetric for audio port";
if (sockVideo != -1) {
if (!gotVideo)
lError() << "No STUN server response for video port";
else {
if (!coneVideo)
lInfo() << "NAT is symmetric for video port";
}
else if (!coneVideo)
lInfo() << "NAT is symmetric for video port";
}
if (sockText != -1) {
if (!gotText)
lError() << "No STUN server response for text port";
else {
if (!coneText)
lInfo() << "NAT is symmetric for text port";
}
else if (!coneText)
lInfo() << "NAT is symmetric for text port";
}
close_socket(sockAudio);
......@@ -150,16 +145,22 @@ void StunClient::updateMediaDescription (SalMediaDescription *md) const {
for (int i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (!sal_stream_description_active(&md->streams[i]))
continue;
if ((md->streams[i].type == SalAudio) && (audioCandidate.port != 0)) {
if (md->streams[i].type == SalAudio && audioCandidate.port != 0) {
strncpy(md->streams[i].rtp_addr, audioCandidate.address.c_str(), sizeof(md->streams[i].rtp_addr));
md->streams[i].rtp_port = audioCandidate.port;
if ((!audioCandidate.address.empty() && !videoCandidate.address.empty() && (audioCandidate.address == videoCandidate.address))
|| (sal_media_description_get_nb_active_streams(md) == 1))
if (
(
!audioCandidate.address.empty() &&
!videoCandidate.address.empty() &&
audioCandidate.address == videoCandidate.address
) ||
sal_media_description_get_nb_active_streams(md) == 1
)
strncpy(md->addr, audioCandidate.address.c_str(), sizeof(md->addr));
} else if ((md->streams[i].type == SalVideo) && (videoCandidate.port != 0)) {
} else if (md->streams[i].type == SalVideo && videoCandidate.port != 0) {
strncpy(md->streams[i].rtp_addr, videoCandidate.address.c_str(), sizeof(md->streams[i].rtp_addr));
md->streams[i].rtp_port = videoCandidate.port;
} else if ((md->streams[i].type == SalText) && (textCandidate.port != 0)) {
} else if (md->streams[i].type == SalText && textCandidate.port != 0) {
strncpy(md->streams[i].rtp_addr, textCandidate.address.c_str(), sizeof(md->streams[i].rtp_addr));
md->streams[i].rtp_port = textCandidate.port;
}
......@@ -187,13 +188,13 @@ ortp_socket_t StunClient::createStunSocket (int localPort) {
return -1;
}
int optval = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (SOCKET_OPTION_VALUE)&optval, sizeof (optval)) < 0)
if (setsockopt(sock, SOL_SOCKET,