Bug 842549 - Part 2: Plumb candidates up to signaling r=abr

This commit is contained in:
EKR 2013-09-16 17:21:33 -07:00
Родитель 9ced8f191b
Коммит 972678629f
29 изменённых файлов: 1162 добавлений и 394 удалений

Просмотреть файл

@ -24,7 +24,7 @@ interface IPeerConnectionManager : nsISupports
*
* See media/webrtc/signaling/include/PeerConnectionImpl.h
*/
[scriptable, uuid(cf9152f0-c9a8-4093-9435-1daa056e0177)]
[scriptable, uuid(896dc16a-05d6-45e4-bdbf-aba57123ed3e)]
interface IPeerConnectionObserver : nsISupports
{
/* Constants */
@ -45,6 +45,7 @@ interface IPeerConnectionObserver : nsISupports
void onSetRemoteDescriptionError(in unsigned long name, in string message);
void onAddIceCandidateSuccess();
void onAddIceCandidateError(in unsigned long name, in string message);
void onIceCandidate(in unsigned short level, in string mid, in string candidate);
/* Data channel callbacks */
void notifyDataChannel(in nsIDOMDataChannel channel);
@ -59,13 +60,6 @@ interface IPeerConnectionObserver : nsISupports
void onRemoveStream();
void onAddTrack();
void onRemoveTrack();
/* When SDP is parsed and a candidate line is found this method is called.
* It should hook back into the media transport to notify it of ICE candidates
* listed in the SDP PeerConnectionImpl does not parse ICE candidates, just
* pulls them out of the SDP.
*/
void foundIceCandidate(in string candidate);
};
[scriptable, uuid(930dce8b-7c5e-4393-b8c0-cb3a928f68bd)]

Просмотреть файл

@ -362,5 +362,10 @@ namespace CSF
of its memory.
*/
virtual Timecard *takeTimecard() = 0;
/**
Get the latest candidate.
*/
virtual std::string getCandidate() = 0;
};
};

Просмотреть файл

@ -34,6 +34,7 @@
extern "C" {
#include "ccsdp.h"
#include "vcm.h"
#include "cc_call_feature.h"
#include "cip_mmgr_mediadefinitions.h"
#include "cip_Sipcc_CodecMask.h"
@ -68,6 +69,7 @@ VcmSIPCCBinding * VcmSIPCCBinding::gSelf = NULL;
int VcmSIPCCBinding::gAudioCodecMask = 0;
int VcmSIPCCBinding::gVideoCodecMask = 0;
nsIThread *VcmSIPCCBinding::gMainThread = NULL;
nsIEventTarget *VcmSIPCCBinding::gSTSThread = NULL;
static mozilla::RefPtr<TransportFlow> vcmCreateTransportFlow(
sipcc::PeerConnectionImpl *pc,
@ -102,10 +104,54 @@ VcmSIPCCBinding::VcmSIPCCBinding ()
gSelf = this;
}
class VcmIceOpaque : public NrIceOpaque {
public:
VcmIceOpaque(cc_streamid_t stream_id,
cc_call_handle_t call_handle,
uint16_t level) :
stream_id_(stream_id),
call_handle_(call_handle),
level_(level) {}
virtual ~VcmIceOpaque() {}
cc_streamid_t stream_id_;
cc_call_handle_t call_handle_;
uint16_t level_;
};
VcmSIPCCBinding::~VcmSIPCCBinding ()
{
assert(gSelf);
gSelf = NULL;
SyncRunnable::DispatchToThread(gSTSThread,
WrapRunnable(this,
&VcmSIPCCBinding::disconnect_all));
disconnect_all();
}
void VcmSIPCCBinding::CandidateReady(NrIceMediaStream* stream,
const std::string& candidate)
{
// This is called on the STS thread
NrIceOpaque *opaque = stream->opaque();
MOZ_ASSERT(opaque);
VcmIceOpaque *vcm_opaque = static_cast<VcmIceOpaque *>(opaque);
CSFLogDebug(logTag, "Candidate ready on call %u, level %u",
vcm_opaque->call_handle_, vcm_opaque->level_);
char *candidate_tmp = (char *)malloc(candidate.size() + 1);
if (!candidate_tmp)
return;
sstrncpy(candidate_tmp, candidate.c_str(), candidate.size() + 1);
// Send a message to the GSM thread.
CC_CallFeature_FoundICECandidate(vcm_opaque->call_handle_,
candidate_tmp,
NULL,
vcm_opaque->level_,
NULL);
}
void VcmSIPCCBinding::setStreamObserver(StreamObserver* obs)
@ -163,11 +209,23 @@ void VcmSIPCCBinding::setMainThread(nsIThread *thread)
gMainThread = thread;
}
void VcmSIPCCBinding::setSTSThread(nsIEventTarget *thread)
{
gSTSThread = thread;
}
nsIThread* VcmSIPCCBinding::getMainThread()
{
return gMainThread;
}
void VcmSIPCCBinding::connectCandidateSignal(
NrIceMediaStream *stream)
{
stream->SignalCandidate.connect(gSelf,
&VcmSIPCCBinding::CandidateReady);
}
/* static */
AudioTermination * VcmSIPCCBinding::getAudioTermination()
{
@ -462,6 +520,12 @@ static short vcmRxAllocICE_m(cc_mcapid_t mcap_id,
return VCM_ERROR;
}
// Set the opaque so we can correlate events.
stream->SetOpaque(new VcmIceOpaque(stream_id, call_handle, level));
// Attach ourself to the candidate signal.
VcmSIPCCBinding::connectCandidateSignal(stream);
std::vector<std::string> candidates = stream->GetCandidates();
CSFLogDebug( logTag, "%s: Got %lu candidates", __FUNCTION__, candidates.size());
@ -733,6 +797,7 @@ static short vcmSetIceCandidate_m(const char *peerconnection,
return 0;
}
/* Set ice candidate for trickle ICE.
*
* This is a thunk to vcmSetIceCandidate_m
@ -792,7 +857,6 @@ static short vcmStartIceChecks_m(const char *peerconnection, cc_boolean isContro
return 0;
}
/* Start ICE checks
*
* This is a thunk to vcmStartIceChecks_m

Просмотреть файл

@ -10,7 +10,14 @@ extern "C"
#include "ccapi_types.h"
}
#include "sigslot.h"
class nsIThread;
class nsIEventTarget;
namespace mozilla {
class NrIceMediaStream;
};
namespace CSF
{
@ -29,13 +36,12 @@ namespace CSF
virtual void dtmfBurst(int digit, int direction, int duration) = 0;
virtual void sendIFrame(cc_call_handle_t call) = 0;
};
class VcmSIPCCBinding
class VcmSIPCCBinding : public sigslot::has_slots<>
{
public:
VcmSIPCCBinding ();
virtual ~VcmSIPCCBinding();
// The getter is only for use by the vcm_* impl functions.
void setStreamObserver(StreamObserver*);
static StreamObserver* getStreamObserver();
@ -58,13 +64,21 @@ namespace CSF
static void setMainThread(nsIThread *thread);
static nsIThread *getMainThread();
static void setSTSThread(nsIEventTarget *thread);
static void connectCandidateSignal(mozilla::NrIceMediaStream* stream);
private:
void CandidateReady(mozilla::NrIceMediaStream* stream,
const std::string& candidate);
static VcmSIPCCBinding * gSelf;
StreamObserver* streamObserver;
MediaProviderObserver *mediaProviderObserver;
static int gAudioCodecMask;
static int gVideoCodecMask;
static nsIThread *gMainThread;
static nsIEventTarget *gSTSThread;
};
}

Просмотреть файл

@ -122,7 +122,8 @@ static void join_waiter() {
NS_ProcessPendingEvents(PeerConnectionCtx::gMainThread);
}
nsresult PeerConnectionCtx::InitializeGlobal(nsIThread *mainThread) {
nsresult PeerConnectionCtx::InitializeGlobal(nsIThread *mainThread,
nsIEventTarget* stsThread) {
if (!gMainThread) {
gMainThread = mainThread;
CSF::VcmSIPCCBinding::setMainThread(gMainThread);
@ -133,6 +134,8 @@ nsresult PeerConnectionCtx::InitializeGlobal(nsIThread *mainThread) {
#endif
}
CSF::VcmSIPCCBinding::setSTSThread(stsThread);
nsresult res;
#ifdef MOZILLA_INTERNAL_API

Просмотреть файл

@ -34,7 +34,7 @@ namespace sipcc {
// * The observer class that demuxes events onto individual PCs.
class PeerConnectionCtx : public CSF::CC_Observer {
public:
static nsresult InitializeGlobal(nsIThread *mainThread);
static nsresult InitializeGlobal(nsIThread *mainThread, nsIEventTarget *stsThread);
static PeerConnectionCtx* GetInstance();
static bool isActive();
static void Destroy();

Просмотреть файл

@ -3,6 +3,8 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <string>
#include <cstdlib>
#include <cerrno>
#include "base/histogram.h"
#include "vcm.h"
@ -139,6 +141,7 @@ public:
mCode(static_cast<PeerConnectionImpl::Error>(aInfo->getStatusCode())),
mReason(aInfo->getStatus()),
mSdpStr(),
mCandidateStr(),
mCallState(aInfo->getCallState()),
mFsmState(aInfo->getFsmState()),
mStateStr(aInfo->callStateToString(mCallState)),
@ -148,8 +151,10 @@ public:
streams = aInfo->getMediaStreams();
mRemoteStream = mPC->media()->GetRemoteStream(streams->media_stream_id);
MOZ_ASSERT(mRemoteStream);
}
if ((mCallState == CREATEOFFERSUCCESS) || (mCallState == CREATEANSWERSUCCESS)) {
} else if (mCallState == FOUNDICECANDIDATE) {
mCandidateStr = aInfo->getCandidate();
} else if ((mCallState == CREATEOFFERSUCCESS) ||
(mCallState == CREATEANSWERSUCCESS)) {
mSdpStr = aInfo->getSDP();
}
}
@ -279,6 +284,45 @@ public:
mObserver->OnAddIceCandidateError(mCode, mReason.c_str());
break;
case FOUNDICECANDIDATE:
{
size_t end_of_level = mCandidateStr.find('\t');
if (end_of_level == std::string::npos) {
MOZ_ASSERT(false);
return NS_OK;
}
std::string level = mCandidateStr.substr(0, end_of_level);
if (!level.size()) {
MOZ_ASSERT(false);
return NS_OK;
}
char *endptr;
errno = 0;
unsigned long level_long =
strtoul(level.c_str(), &endptr, 10);
if (errno || *endptr != 0 || level_long > 65535) {
/* Conversion failure */
MOZ_ASSERT(false);
return NS_OK;
}
size_t end_of_mid = mCandidateStr.find('\t', end_of_level + 1);
if (end_of_mid == std::string::npos) {
MOZ_ASSERT(false);
return NS_OK;
}
std::string mid = mCandidateStr.substr(end_of_level + 1,
end_of_mid - (end_of_level + 1));
std::string candidate = mCandidateStr.substr(end_of_mid + 1);
mObserver->OnIceCandidate(
level_long & 0xffff,
mid.c_str(),
candidate.c_str());
}
break;
case REMOTESTREAMADD:
{
DOMMediaStream* stream = nullptr;
@ -323,6 +367,7 @@ private:
PeerConnectionImpl::Error mCode;
std::string mReason;
std::string mSdpStr;
std::string mCandidateStr;
cc_call_state_t mCallState;
fsmdef_states_t mFsmState;
std::string mStateStr;
@ -346,7 +391,9 @@ PeerConnectionImpl::PeerConnectionImpl()
, mMedia(NULL)
, mNumAudioStreams(0)
, mNumVideoStreams(0)
, mHaveDataStream(false) {
, mHaveDataStream(false)
, mTrickle(true) // TODO(ekr@rtfm.com): Use pref
{
#ifdef MOZILLA_INTERNAL_API
MOZ_ASSERT(NS_IsMainThread());
#endif
@ -606,7 +653,7 @@ PeerConnectionImpl::Initialize(IPeerConnectionObserver* aObserver,
mHandle = hex;
STAMP_TIMECARD(mTimeCard, "Initializing PC Ctx");
res = PeerConnectionCtx::InitializeGlobal(mThread);
res = PeerConnectionCtx::InitializeGlobal(mThread, mSTSThread);
NS_ENSURE_SUCCESS(res, res);
PeerConnectionCtx *pcctx = PeerConnectionCtx::GetInstance();
@ -1311,7 +1358,7 @@ nsresult
PeerConnectionImpl::CheckApiState(bool assert_ice_ready) const
{
PC_AUTO_ENTER_API_CALL_NO_CHECK();
PR_ASSERT(!assert_ice_ready || (mIceState != kIceGathering));
MOZ_ASSERT(mTrickle || !assert_ice_ready || (mIceState != kIceGathering));
if (mReadyState == kClosed)
return NS_ERROR_FAILURE;

Просмотреть файл

@ -386,6 +386,8 @@ private:
// Holder for error messages from parsing SDP
std::vector<std::string> mSDPParseErrorMessages;
bool mTrickle;
public:
//these are temporary until the DataChannel Listen/Connect API is removed
unsigned short listenPort;

Просмотреть файл

@ -107,6 +107,7 @@ typedef struct cc_call_info_t_{
unsigned int media_stream_track_id;
unsigned int media_stream_id;
cc_media_constraints_t* cc_constraints;
string_t candidate;
Timecard * timecard;
} session_data_t;

Просмотреть файл

@ -149,6 +149,10 @@ cc_return_t cc_invokeFeatureSDPMode(cc_call_handle_t call_handle,
callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
callFeature.featData.ccData.info1 = strlib_malloc(data1, strlen(data1));
break;
case CC_FEATURE_FOUNDICECANDIDATE:
callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
callFeature.featData.ccData.info1 = NULL;
break;
default:
callFeature.featData.ccData.info = NULL;
@ -374,6 +378,19 @@ cc_return_t CC_CallFeature_AddICECandidate(cc_call_handle_t call_handle,
0, 0, NO_STREAM, (uint16_t)level, constraints, candidate, mid, tc);
}
cc_return_t CC_CallFeature_FoundICECandidate(cc_call_handle_t call_handle,
const char* candidate,
const char *mid,
cc_level_t level,
Timecard *tc) {
cc_media_constraints_t *constraints = NULL;
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
GET_LINE_ID(call_handle), __FUNCTION__));
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_FOUNDICECANDIDATE, JSEP_NO_ACTION,
0, 0, NO_STREAM, (uint16_t)level, constraints, candidate, mid, tc);
}
/**
* Initiate a speed dial.
* @param call handle

Просмотреть файл

@ -747,6 +747,24 @@ cc_string_t CCAPI_CallInfo_getSDP(cc_callinfo_ref_t handle){
return strlib_empty();
}
/**
* get candidate for trickle ICE
* @param handle - call handle
* @return sdp
*/
cc_string_t CCAPI_CallInfo_getCandidate(cc_callinfo_ref_t handle){
static const char *fname="CCAPI_CallInfo_getCandiate";
session_data_t *data = (session_data_t *)handle;
CCAPP_DEBUG(DEB_F_PREFIX"Entering", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
if (data){
CCAPP_DEBUG(DEB_F_PREFIX"returned %s", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->candidate);
return data->candidate;
}
return strlib_empty();
}
/**
* get status code from internal JSEP functions
* @param handle - call handle

Просмотреть файл

@ -710,6 +710,13 @@ processSessionEvent (line_t line_id, callid_t call_id, unsigned int event, sdp_d
sstrncpy(featdata.candidate.mid, data1, sizeof(featdata.candidate.mid)-1);
cc_int_feature2(CC_MSG_ADDCANDIDATE, CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_ADDICECANDIDATE, &featdata, timecard);
break;
case CC_FEATURE_FOUNDICECANDIDATE:
STAMP_TIMECARD(timecard, "Processing found candidate event");
featdata.candidate.level = ccData.level;
sstrncpy(featdata.candidate.candidate, data, sizeof(featdata.candidate.candidate)-1);
sstrncpy(featdata.candidate.mid, data1, sizeof(featdata.candidate.mid)-1);
cc_int_feature2(CC_MSG_FOUNDCANDIDATE, CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_FOUNDICECANDIDATE, &featdata, timecard);
break;
case CC_FEATURE_DIALSTR:
if (CheckAndGetAvailableLine(&line_id, &call_id) == TRUE) {
getDigits(data, digits, sizeof(digits));
@ -1061,7 +1068,8 @@ session_data_t * getDeepCopyOfSessionData(session_data_t *data)
newData->plcd_number = strlib_copy(data->plcd_number);
newData->status = strlib_copy(data->status);
newData->sdp = strlib_copy(data->sdp);
newData->candidate = data->candidate ?
strlib_copy(data->candidate) : strlib_empty();
/* The timecard can have only one owner */
newData->timecard = data->timecard;
data->timecard = NULL;
@ -1085,6 +1093,7 @@ session_data_t * getDeepCopyOfSessionData(session_data_t *data)
newData->plcd_number = strlib_empty();
newData->status = strlib_empty();
newData->sdp = strlib_empty();
newData->candidate = strlib_empty();
newData->timecard = NULL;
calllogger_init_call_log(&newData->call_log);
}
@ -1132,6 +1141,9 @@ void cleanSessionData(session_data_t *data)
data->status = strlib_empty();
strlib_free(data->sdp);
data->sdp = strlib_empty();
if (data->candidate)
strlib_free(data->candidate);
data->candidate = strlib_empty();
data->timecard = NULL;
calllogger_free_call_log(&data->call_log);
}
@ -1450,6 +1462,7 @@ static void ccappUpdateSessionData (session_update_t *sessUpd)
sessUpd->eventID == UPDATE_LOCAL_DESC ||
sessUpd->eventID == UPDATE_REMOTE_DESC ||
sessUpd->eventID == ICE_CANDIDATE_ADD ||
sessUpd->eventID == ICE_CANDIDATE_FOUND ||
sessUpd->eventID == REMOTE_STREAM_ADD ) {
data->attr = sessUpd->update.ccSessionUpd.data.state_data.attr;
data->inst = sessUpd->update.ccSessionUpd.data.state_data.inst;
@ -1832,6 +1845,12 @@ static void ccappUpdateSessionData (session_update_t *sessUpd)
case UPDATE_LOCAL_DESC:
case UPDATE_REMOTE_DESC:
case ICE_CANDIDATE_ADD:
case ICE_CANDIDATE_FOUND:
if (sessUpd->update.ccSessionUpd.data.state_data.extra) {
if (sessUpd->eventID == ICE_CANDIDATE_FOUND) {
data->candidate = sessUpd->update.ccSessionUpd.data.state_data.extra;
}
}
data->sdp = sessUpd->update.ccSessionUpd.data.state_data.sdp;
/* Fall through to the next case... */
case REMOTE_STREAM_ADD:

Просмотреть файл

@ -1556,6 +1556,7 @@ static void post_message_helper(group_call_event_t eventId,
callid_t nCallId,
uint16_t call_instance_id,
string_t sdp,
string_t extra,
Timecard *timecard,
pc_error error,
const char *format,
@ -1580,6 +1581,7 @@ static void post_message_helper(group_call_event_t eventId,
msg.update.ccSessionUpd.data.state_data.inst = call_instance_id;
msg.update.ccSessionUpd.data.state_data.line_id = nLine;
msg.update.ccSessionUpd.data.state_data.sdp = sdp;
msg.update.ccSessionUpd.data.state_data.extra = extra;
msg.update.ccSessionUpd.data.state_data.cause = error;
msg.update.ccSessionUpd.data.state_data.timecard = timecard;
@ -1627,7 +1629,7 @@ void ui_create_offer(call_events event,
va_start(ap, format);
post_message_helper(CREATE_OFFER, event, new_state, nLine, nCallID,
call_instance_id, sdp, timecard, error, format, ap);
call_instance_id, sdp, NULL, timecard, error, format, ap);
va_end(ap);
return;
@ -1655,7 +1657,7 @@ void ui_create_answer(call_events event,
va_start(ap, format);
post_message_helper(CREATE_ANSWER, event, new_state, nLine, nCallID,
call_instance_id, sdp, timecard, error, format, ap);
call_instance_id, sdp, NULL, timecard, error, format, ap);
va_end(ap);
return;
@ -1683,7 +1685,7 @@ void ui_set_local_description(call_events event,
va_start(ap, format);
post_message_helper(SET_LOCAL_DESC, event, new_state, nLine, nCallID,
call_instance_id, sdp, timecard, error, format, ap);
call_instance_id, sdp, NULL, timecard, error, format, ap);
va_end(ap);
return;
@ -1711,7 +1713,7 @@ void ui_set_remote_description(call_events event,
va_start(ap, format);
post_message_helper(SET_REMOTE_DESC, event, new_state, nLine, nCallID,
call_instance_id, sdp, timecard, error, format, ap);
call_instance_id, sdp, NULL, timecard, error, format, ap);
va_end(ap);
return;
@ -1740,7 +1742,7 @@ void ui_update_local_description(call_events event,
va_start(ap, format);
post_message_helper(UPDATE_LOCAL_DESC, event, new_state, nLine, nCallID,
call_instance_id, sdp, timecard, error, format, ap);
call_instance_id, sdp, NULL, timecard, error, format, ap);
va_end(ap);
return;
@ -1768,7 +1770,35 @@ void ui_ice_candidate_add(call_events event,
va_start(ap, format);
post_message_helper(ICE_CANDIDATE_ADD, event, new_state, nLine, nCallID,
call_instance_id, sdp, timecard, error, format, ap);
call_instance_id, sdp, NULL, timecard, error, format, ap);
va_end(ap);
}
/**
* Send data from foundIceCandidate to the UI
*
* @return none
*/
void ui_ice_candidate_found(call_events event,
fsmdef_states_t new_state,
line_t nLine,
callid_t nCallID,
uint16_t call_instance_id,
string_t sdp,
string_t candidate,
Timecard *timecard,
pc_error error,
const char *format, ...)
{
va_list ap;
TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d",
DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id);
va_start(ap, format);
post_message_helper(ICE_CANDIDATE_FOUND, event, new_state, nLine, nCallID,
call_instance_id, sdp, candidate, timecard, error, format, ap);
va_end(ap);
}

Просмотреть файл

@ -37,6 +37,7 @@
#include "platform_api.h"
#include "peer_connection_types.h"
#include "prlog.h"
#include "prprf.h"
#include "sessionHash.h"
extern void update_kpmlconfig(int kpmlVal);
@ -93,6 +94,7 @@ static sm_rcs_t fsmdef_ev_setpeerconnection(sm_event_t *event);
static sm_rcs_t fsmdef_ev_addstream(sm_event_t *event);
static sm_rcs_t fsmdef_ev_removestream(sm_event_t *event);
static sm_rcs_t fsmdef_ev_addcandidate(sm_event_t *event);
static sm_rcs_t fsmdef_ev_foundcandidate(sm_event_t *event);
static sm_rcs_t fsmdef_ev_default(sm_event_t *event);
static sm_rcs_t fsmdef_ev_default_feature_ack(sm_event_t *event);
@ -202,7 +204,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_setpeerconnection,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_COLLECT_INFO ---------------------------------------------------- */
@ -232,7 +235,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_CALL_SENT ------------------------------------------------------- */
@ -262,7 +266,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_OUTGOING_PROCEEDING --------------------------------------------- */
@ -292,7 +297,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_KPML_COLLECT_INFO ----------------------------------------------- */
@ -322,7 +328,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_OUTGOING_ALERTING ----------------------------------------------- */
@ -352,7 +359,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_INCOMING_ALERTING ----------------------------------------------- */
@ -382,7 +390,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_CONNECTING ------------------------------------------------------ */
@ -412,7 +421,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_JOINING --------------------------------------------------------- */
@ -442,7 +452,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_CONNECTED ------------------------------------------------------- */
@ -472,7 +483,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_CONNECTED_MEDIA_PEND ------------------------------------------- */
@ -502,7 +514,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_RELEASING ------------------------------------------------------- */
@ -532,7 +545,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_HOLD_PENDING ---------------------------------------------------- */
@ -562,7 +576,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_HOLDING --------------------------------------------------------- */
@ -592,7 +607,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_RESUME_PENDING -------------------------------------------------- */
@ -622,7 +638,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_PRESERVED ------------------------------------------------------ */
@ -652,7 +669,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
@ -683,7 +701,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_addstream,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_removestream,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_foundcandidate
},
/* FSMDEF_S_HAVE_LOCAL_OFFER ----------------------------------------------- */
@ -713,8 +732,9 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default /* Reject lame-duck
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default, /* Reject lame-duck
candidates */
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_foundcandidate
},
/* FSMDEF_S_HAVE_REMOTE_OFFER ---------------------------------------------- */
@ -744,7 +764,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_addstream,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_removestream,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
},
/* FSMDEF_S_HAVE_LOCAL_PRANSWER -------------------------------------------- */
@ -774,7 +795,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_foundcandidate
},
/* FSMDEF_S_HAVE_REMOTE_PRANSWER ------------------------------------------- */
@ -804,7 +826,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_foundcandidate
},
/* FSMDEF_S_CLOSED --------------------------------------------------------- */
@ -834,7 +857,8 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
/* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
/* CC_MSG_ADDSTREAM */ fsmdef_ev_default,
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_default,
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_default,
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
}
};
@ -1302,6 +1326,8 @@ fsmdef_init_dcb (fsmdef_dcb_t *dcb, callid_t call_id,
dcb->digest_alg[0] = '\0';
dcb->digest[0] = '\0';
sll_lite_init(&dcb->candidate_list);
}
@ -1351,6 +1377,9 @@ fsmdef_free_dcb (fsmdef_dcb_t *dcb)
/* clean media list */
gsmsdp_clean_media_list(dcb);
/* clean candidate list */
gsmsdp_clean_candidate_list(dcb);
gsmsdp_free(dcb);
fsmdef_init_dcb(dcb, CC_NO_CALL_ID, FSMDEF_CALL_TYPE_NONE, NULL,
@ -2455,6 +2484,14 @@ fsmdef_ev_default (sm_event_t *event)
fsmdef_state_name(fcb->state));
break;
case CC_MSG_FOUNDCANDIDATE:
ui_ice_candidate_found(evFoundIceCandidateError, fcb->state, msg->line,
msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(),
NULL, msg->timecard,
PC_INVALID_STATE, "Cannot add found ICE candidate in state %s",
fsmdef_state_name(fcb->state));
break;
case CC_MSG_ADDSTREAM:
case CC_MSG_REMOVESTREAM:
/* This shouldn't happen, since PeerConnection should check
@ -3170,6 +3207,9 @@ fsmdef_ev_createoffer (sm_event_t *event) {
return (SM_RC_END);
}
/* clean candidate list, since we are about to return the candidates */
gsmsdp_clean_candidate_list(dcb);
dcb->inbound = FALSE;
if (msg->data.session.constraints) {
@ -3331,6 +3371,9 @@ fsmdef_ev_createanswer (sm_event_t *event) {
return (SM_RC_END);
}
/* clean candidate list, since we are about to return the candidates */
gsmsdp_clean_candidate_list(dcb);
dcb->inbound = TRUE;
if (msg->data.session.constraints) {
@ -3459,6 +3502,7 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) {
cc_causes_t lsm_rc;
char *local_sdp = NULL;
uint32_t local_sdp_len = 0;
fsmdef_candidate_t *candidate = NULL;
FSM_DEBUG_SM(DEB_F_PREFIX"Entered.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
@ -3603,6 +3647,21 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) {
msg->call_id, dcb->caller_id.call_instance_id,
strlib_malloc(local_sdp,-1), msg->timecard, PC_NO_ERROR, NULL);
/* If we have pending candidates flush them too */
while (TRUE) {
/* unlink head and free the media */
candidate = (fsmdef_candidate_t *)sll_lite_unlink_head(&dcb->candidate_list);
if (candidate) {
ui_ice_candidate_found(evFoundIceCandidate, fcb->state, line, call_id,
dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1),
candidate->candidate, /* Transfer ownership */
NULL, PC_NO_ERROR, NULL);
free(candidate);
} else {
break;
}
}
free(local_sdp);
return (SM_RC_END);
}
@ -4122,6 +4181,117 @@ fsmdef_ev_addcandidate(sm_event_t *event) {
return (SM_RC_END);
}
static sm_rcs_t
fsmdef_ev_foundcandidate(sm_event_t *event) {
fsm_fcb_t *fcb = (fsm_fcb_t *) event->data;
fsmdef_dcb_t *dcb = fcb->dcb;
cc_causes_t cause = CC_CAUSE_NORMAL;
cc_feature_t *msg = (cc_feature_t *) event->msg;
int sdpmode = 0;
short vcm_res;
uint16_t level;
line_t line = msg->line;
callid_t call_id = msg->call_id;
char *local_sdp = 0;
uint32_t local_sdp_len = 0;
string_t candidate = 0;
char candidate_tmp[CANDIDATE_SIZE + 32]; /* Sort of arbitrary */
FSM_DEBUG_SM(DEB_F_PREFIX"Entered.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
if (!dcb) {
FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id,
0, strlib_empty(), msg->timecard, PC_INTERNAL_ERROR,
"DCB has not been created.");
return SM_RC_CLEANUP;
}
config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode));
if (!sdpmode) {
MOZ_CRASH();
}
MOZ_ASSERT(dcb->sdp && dcb->sdp->src_sdp);
if (!dcb->sdp || !dcb->sdp->src_sdp) {
FSM_DEBUG_SM(DEB_F_PREFIX"Has the "
"local description been set yet?\n",
DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
ui_ice_candidate_found(evFoundIceCandidateError, fcb->state, line, call_id,
dcb->caller_id.call_instance_id, strlib_empty(),
NULL, msg->timecard,
PC_INVALID_STATE, "Cannot add found ICE candidates without"
"local SDP.");
return SM_RC_END;
}
/* Store the candidate in the SDP for future reference */
level = msg->data.candidate.level;
gsmsdp_set_ice_attribute (SDP_ATTR_ICE_CANDIDATE, level,
dcb->sdp->src_sdp,
(char *)msg->data.candidate.candidate);
local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len);
if (!local_sdp) {
ui_ice_candidate_found(evFoundIceCandidateError, fcb->state, line, call_id,
dcb->caller_id.call_instance_id, strlib_empty(), NULL,
msg->timecard,
PC_INTERNAL_ERROR, "Could not serialize new SDP after adding ICE "
"candidate.");
return (SM_RC_END);
}
/* Distinguish between the following two cases:
1. CreateOffer() has been called but SetLocalDesc() has not.
2. We are mid-call.
Both of these are in state STABLE but only in one do we
pass up trickle candidates. In the other we buffer them
and send them later.
*/
/* Smuggle the entire candidate structure in a string */
PR_snprintf(candidate_tmp, sizeof(candidate_tmp), "%d\t%s\t%s",
msg->data.candidate.level,
(char *)msg->data.candidate.mid,
(char *)msg->data.candidate.candidate);
if (fcb->state == FSMDEF_S_STABLE) {
if (!dcb->sdp->dest_sdp) {
fsmdef_candidate_t *buffered_cand = NULL;
FSM_DEBUG_SM(DEB_F_PREFIX"dcb->sdp->dest_sdp is null."
"assuming CreateOffer called but not SetLocal...\n",
DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
buffered_cand = (fsmdef_candidate_t *)cpr_malloc(sizeof(fsmdef_candidate_t));
if (!buffered_cand)
return SM_RC_END;
buffered_cand->candidate = strlib_malloc(candidate_tmp, -1);
if (sll_lite_link_head(&dcb->candidate_list,
(sll_lite_node_t *)buffered_cand) != SLL_LITE_RET_SUCCESS)
return SM_RC_END;
/* Don't notify upward */
return SM_RC_END;
}
}
ui_ice_candidate_found(evFoundIceCandidate, fcb->state, line, call_id,
dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1),
strlib_malloc(candidate_tmp, -1),
msg->timecard, PC_NO_ERROR, NULL);
return SM_RC_END;
}
static void
fsmdef_check_active_feature (fsmdef_dcb_t *dcb, cc_features_t ftr_id)
{

Просмотреть файл

@ -7327,3 +7327,31 @@ gsmsdp_find_level_from_mid(fsmdef_dcb_t * dcb_p, const char * mid, uint16_t *lev
}
return CC_CAUSE_VALUE_NOT_FOUND;
}
/**
* The function performs cleaning candidate list of a given call. It walks
* through the list and deallocates each candidate entry.
*
* @param[in]dcb - pointer to fsmdef_def_t for the dcb whose
* media list to be cleaned.
*
* @return none
*
* @pre (dcb not_eq NULL)
*/
void gsmsdp_clean_candidate_list (fsmdef_dcb_t *dcb_p)
{
fsmdef_candidate_t *candidate = NULL;
while (TRUE) {
/* unlink head and free the media */
candidate = (fsmdef_candidate_t *)sll_lite_unlink_head(&dcb_p->candidate_list);
if (candidate) {
strlib_free(candidate->candidate);
free(candidate);
} else {
break;
}
}
}

Просмотреть файл

@ -429,6 +429,7 @@ typedef struct {
char digest_alg[FSMDEF_MAX_DIGEST_ALG_LEN];
char digest[FSMDEF_MAX_DIGEST_LEN];
sll_lite_list_t candidate_list;
} fsmdef_dcb_t;
typedef enum fsm_types_t_ {
@ -498,6 +499,11 @@ typedef enum fsmxfr_modes_t_ {
FSMXFR_MODE_TARGET
} fsmxfr_modes_t;
typedef struct fsmdef_candidate_t_ {
sll_lite_node_t node; /* link node, must be first member of struct */
string_t candidate; /* the candidate value */
} fsmdef_candidate_t;
struct fsmxfr_xcb_t_;
typedef struct fsmxfr_xcb_t_ {
cc_srcs_t xfr_orig;

Просмотреть файл

@ -141,6 +141,7 @@ fsmdef_media_t* gsmsdp_find_media_by_media_type(fsmdef_dcb_t *dcb, sdp_media_e
extern void gsmsdp_set_ice_attribute (sdp_attr_e sdp_attr, uint16_t level,
void *sdp_p, char *ice_attrib);
extern void gsmsdp_clean_candidate_list(fsmdef_dcb_t *dcb);
#endif

Просмотреть файл

@ -103,6 +103,7 @@ typedef enum {
CC_FEATURE_ADDSTREAM,
CC_FEATURE_REMOVESTREAM,
CC_FEATURE_ADDICECANDIDATE,
CC_FEATURE_FOUNDICECANDIDATE,
CC_FEATURE_MAX
} group_cc_feature_t;
@ -168,6 +169,7 @@ static const char *const cc_feature_names[] = {
"ADDSTREAM",
"REMOVESTREAM",
"ADDICECANDIDATE",
"FOUNDICECANDIDATE",
"MAX"
};
@ -241,6 +243,7 @@ typedef enum cc_msgs_t_ {
CC_MSG_ADDSTREAM,
CC_MSG_REMOVESTREAM,
CC_MSG_ADDCANDIDATE,
CC_MSG_FOUNDCANDIDATE,
CC_MSG_AUDIT_ACK,
CC_MSG_OPTIONS,
CC_MSG_OPTIONS_ACK,
@ -280,6 +283,7 @@ static const char *const cc_msg_names[] = {
"ADDSTREAM",
"REMOVESTREAM",
"ADDCANDIDATE",
"FOUNDCANDIDATE",
"AUDIT_ACK",
"OPTIONS",
"OPTIONS_ACK",

Просмотреть файл

@ -223,7 +223,8 @@ typedef enum {
UPDATE_LOCAL_DESC,
UPDATE_REMOTE_DESC,
REMOTE_STREAM_ADD,
ICE_CANDIDATE_ADD
ICE_CANDIDATE_ADD,
ICE_CANDIDATE_FOUND
} group_call_event_t;
/* File Player Session Events */

Просмотреть файл

@ -66,6 +66,7 @@ typedef struct {
int cause;
string_t reason_text;
string_t sdp;
string_t extra;
unsigned int media_stream_id;
unsigned int media_stream_track_id;
Timecard * timecard;

Просмотреть файл

@ -44,6 +44,8 @@ typedef enum {
evOnRemoteStreamAdd = REMOTESTREAMADD,
evAddIceCandidate = ADDICECANDIDATE,
evAddIceCandidateError = ADDICECANDIDATEERROR,
evFoundIceCandidate = FOUNDICECANDIDATE,
evFoundIceCandidateError = FOUNDICECANDIDATEERROR,
evMaxEvent
} call_events;
@ -240,6 +242,17 @@ void ui_ice_candidate_add(call_events event,
pc_error error,
const char *format, ...);
void ui_ice_candidate_found(call_events event,
fsmdef_states_t new_state,
line_t nLine,
callid_t nCallID,
uint16_t call_instance_id,
string_t sdp,
string_t candidate,
Timecard *timecard,
pc_error error,
const char *format, ...);
void ui_on_remote_stream_added(call_events event,
fsmdef_states_t new_state,
line_t nLine,

Просмотреть файл

@ -186,6 +186,11 @@ cc_return_t CC_CallFeature_AddICECandidate(cc_call_handle_t call_handle,
const char *mid,
cc_level_t level,
Timecard *tc);
cc_return_t CC_CallFeature_FoundICECandidate(cc_call_handle_t call_handle,
const char* candidate,
const char *mid,
cc_level_t level,
Timecard *tc);
/**
* Initiate a speed dial.

Просмотреть файл

@ -289,6 +289,8 @@ typedef enum {
REMOTESTREAMADD,
ADDICECANDIDATE,
ADDICECANDIDATEERROR,
FOUNDICECANDIDATE,
FOUNDICECANDIDATEERROR,
MAX_CALL_STATES
} cc_call_state_t;

Просмотреть файл

@ -302,6 +302,13 @@ cc_boolean CCAPI_CallInfo_isVideoMuted(cc_callinfo_ref_t handle);
*/
cc_string_t CCAPI_CallInfo_getSDP(cc_callinfo_ref_t handle);
/**
* get trickle candidate
* @param [in] handle - call info handle
* @return sdp
*/
cc_string_t CCAPI_CallInfo_getCandidate(cc_callinfo_ref_t handle);
/**
* get status code from internal JSEP functions
* @param [in] handle - call info handle

Просмотреть файл

@ -454,6 +454,11 @@ Timecard *CC_SIPCCCallInfo::takeTimecard()
return CCAPI_CallInfo_takeTimecard(callinfo_ref);
}
std::string CC_SIPCCCallInfo::getCandidate()
{
return CCAPI_CallInfo_getCandidate(callinfo_ref);
}
bool CC_SIPCCCallInfo::isMediaStateAvailable()
{
// for softphone it will always be possible to query the mute state and video direction

Просмотреть файл

@ -80,6 +80,7 @@ namespace CSF
virtual bool isAudioMuted();
virtual bool isVideoMuted();
virtual std::string getSDP();
virtual std::string getCandidate();
virtual cc_int32_t getStatusCode();
virtual MediaStreamTable* getMediaStreams() const;
virtual Timecard *takeTimecard();

Просмотреть файл

@ -114,6 +114,8 @@ endif
DEFINES += \
-DUSE_FAKE_MEDIA_STREAMS \
-DNR_SOCKET_IS_VOID_PTR \
-DHAVE_STRDUP \
$(NULL)
ifeq ($(OS_TARGET),Darwin)
@ -141,9 +143,35 @@ LOCAL_INCLUDES += \
-I$(topsrcdir)/media/webrtc/signaling/src/peerconnection \
-I$(topsrcdir)/media/webrtc/signaling/media-conduit\
-I$(topsrcdir)/media/webrtc/trunk/third_party/libjingle/source/ \
-I$(topsrcdir)/media/mtransport/third_party/nICEr/src/ice \
-I$(topsrcdir)/media/mtransport/third_party/nICEr/src/net \
-I$(topsrcdir)/media/mtransport/third_party/nICEr/src/stun \
-I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/share \
-I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/util/libekr \
-I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/log \
-I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/registry \
-I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/stats \
-I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/plugin \
-I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/event \
-I$(topsrcdir)/xpcom/base/ \
$(NULL)
ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include
ifneq (,$(filter DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include
endif
endif
ifeq ($(OS_TARGET), Linux)
LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include
endif
ifeq ($(OS_TARGET), Android)
LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/android/include
endif
ifneq ($(OS_TARGET),WINNT)
ifneq (gonk,$(MOZ_WIDGET_TOOLKIT))
ifdef JS_SHARED_LIBRARY

Просмотреть файл

@ -40,7 +40,8 @@ static bool SetupGlobalThread() {
return false;
gThread = thread;
sipcc::PeerConnectionCtx::InitializeGlobal(gThread);
sipcc::PeerConnectionCtx::InitializeGlobal(gThread,
test_utils->sts_target());
}
return true;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу