mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 824220: Pass constraints through directly through message, deallocate when done r=jesup
This commit is contained in:
parent
a4250e5b65
commit
1ec34c7bd6
@ -268,9 +268,9 @@ namespace CSF
|
||||
*/
|
||||
virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip) = 0;
|
||||
|
||||
virtual void createOffer (const cc_media_constraints_t* constraints) = 0;
|
||||
virtual void createOffer (cc_media_constraints_t* constraints) = 0;
|
||||
|
||||
virtual void createAnswer(const cc_media_constraints_t* constraints) = 0;
|
||||
virtual void createAnswer(cc_media_constraints_t* constraints) = 0;
|
||||
|
||||
virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp) = 0;
|
||||
|
||||
|
@ -98,7 +98,7 @@ typedef struct cc_call_info_t_{
|
||||
cc_string_t sdp;
|
||||
unsigned int media_stream_track_id;
|
||||
unsigned int media_stream_id;
|
||||
const cc_media_constraints_t* cc_constraints;
|
||||
cc_media_constraints_t* cc_constraints;
|
||||
} session_data_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -97,11 +97,17 @@ cc_return_t cc_invokeFeature(cc_call_handle_t call_handle, group_cc_feature_t fe
|
||||
/**
|
||||
* Invoke a call feature.
|
||||
*/
|
||||
cc_return_t cc_invokeFeatureSDPMode(cc_call_handle_t call_handle, group_cc_feature_t featureId, cc_jsep_action_t action,
|
||||
cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type,
|
||||
uint16_t level, const cc_media_constraints_t *constraints, string_t data, string_t data1) {
|
||||
cc_return_t cc_invokeFeatureSDPMode(cc_call_handle_t call_handle,
|
||||
group_cc_feature_t featureId,
|
||||
cc_jsep_action_t action,
|
||||
cc_media_stream_id_t stream_id,
|
||||
cc_media_track_id_t track_id,
|
||||
cc_media_type_t media_type,
|
||||
uint16_t level,
|
||||
cc_media_constraints_t *constraints,
|
||||
string_t data,
|
||||
string_t data1) {
|
||||
session_feature_t callFeature;
|
||||
session_data_t * sessionData;
|
||||
unsigned int session_id = 0;
|
||||
callFeature.session_id = (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT) + call_handle;
|
||||
callFeature.featureID = featureId;
|
||||
@ -110,24 +116,7 @@ cc_return_t cc_invokeFeatureSDPMode(cc_call_handle_t call_handle, group_cc_featu
|
||||
callFeature.featData.ccData.stream_id = stream_id;
|
||||
callFeature.featData.ccData.track_id = track_id;
|
||||
callFeature.featData.ccData.level = level;
|
||||
callFeature.featData.ccData.has_constraints = FALSE;
|
||||
|
||||
/* If constraints exist add to session hash */
|
||||
if (constraints) {
|
||||
if (constraints->constraint_count > 0 &&
|
||||
(CC_FEATURE_CREATEOFFER == featureId || CC_FEATURE_CREATEANSWER == featureId )) {
|
||||
/* A random number of 5 digits will not conflict with any
|
||||
* other usage of the hash table */
|
||||
session_id = abs(cpr_rand()) % 60000;
|
||||
sessionData = (session_data_t *)findhash(session_id);
|
||||
sessionData = cpr_malloc(sizeof(session_data_t));
|
||||
memset(sessionData, 0, sizeof(session_data_t));
|
||||
sessionData->cc_constraints = constraints;
|
||||
(void) addhash(session_id, sessionData);
|
||||
callFeature.featData.ccData.sessionid = session_id;
|
||||
callFeature.featData.ccData.has_constraints = TRUE;
|
||||
}
|
||||
}
|
||||
callFeature.featData.ccData.constraints = constraints;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"cc_invokeFeatureSDPMode:sid=%d, line=%d, cid=%d, fid=%d, video_pref=%s data=%s\n",
|
||||
DEB_F_PREFIX_ARGS("cc_call_feature", "cc_invokeFeatureSDPMode"),
|
||||
@ -295,7 +284,8 @@ cc_return_t CC_CallFeature_dial(cc_call_handle_t call_handle, cc_sdp_direction_t
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_DIALSTR, video_pref, numbers);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints) {
|
||||
cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle,
|
||||
cc_media_constraints_t *constraints) {
|
||||
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__));
|
||||
|
||||
@ -303,7 +293,8 @@ cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, const cc_me
|
||||
0, 0, NO_STREAM, 0, constraints, NULL, NULL);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints) {
|
||||
cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle,
|
||||
cc_media_constraints_t *constraints) {
|
||||
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__));
|
||||
|
||||
@ -312,7 +303,7 @@ cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_m
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_SetLocalDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, string_t sdp) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
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__));
|
||||
|
||||
@ -321,7 +312,7 @@ cc_return_t CC_CallFeature_SetLocalDescription(cc_call_handle_t call_handle, cc_
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_SetRemoteDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, string_t sdp) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
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__));
|
||||
|
||||
@ -330,7 +321,7 @@ cc_return_t CC_CallFeature_SetRemoteDescription(cc_call_handle_t call_handle, cc
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t pc) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
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__));
|
||||
|
||||
@ -340,7 +331,7 @@ cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_pe
|
||||
|
||||
cc_return_t CC_CallFeature_AddStream(cc_call_handle_t call_handle, cc_media_stream_id_t stream_id,
|
||||
cc_media_track_id_t track_id, cc_media_type_t media_type) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
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__));
|
||||
|
||||
@ -351,7 +342,7 @@ cc_return_t CC_CallFeature_AddStream(cc_call_handle_t call_handle, cc_media_stre
|
||||
cc_return_t CC_CallFeature_RemoveStream(cc_call_handle_t call_handle, cc_media_stream_id_t stream_id,
|
||||
cc_media_track_id_t track_id, cc_media_type_t media_type) {
|
||||
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
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__));
|
||||
|
||||
@ -360,7 +351,7 @@ cc_return_t CC_CallFeature_RemoveStream(cc_call_handle_t call_handle, cc_media_s
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_AddICECandidate(cc_call_handle_t call_handle, const char* candidate, const char *mid, cc_level_t level) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
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__));
|
||||
|
||||
|
@ -90,11 +90,13 @@ cc_return_t CCAPI_Call_originateCall(cc_call_handle_t handle, cc_sdp_direction_t
|
||||
return CC_CallFeature_dial(handle, video_pref, digits);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, const cc_media_constraints_t *constraints) {
|
||||
cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle,
|
||||
cc_media_constraints_t *constraints) {
|
||||
return CC_CallFeature_CreateOffer(handle, constraints);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle, const cc_media_constraints_t *constraints) {
|
||||
cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle,
|
||||
cc_media_constraints_t *constraints) {
|
||||
return CC_CallFeature_CreateAnswer(handle, constraints);
|
||||
}
|
||||
|
||||
|
@ -589,13 +589,11 @@ processSessionEvent (line_t line_id, callid_t call_id, unsigned int event, sdp_d
|
||||
dp_int_update_keypress(line_id, call_id, BKSP_KEY);
|
||||
break;
|
||||
case CC_FEATURE_CREATEOFFER:
|
||||
featdata.session.sessionid = ccData.sessionid;
|
||||
featdata.session.has_constraints = ccData.has_constraints;
|
||||
featdata.session.constraints = ccData.constraints;
|
||||
cc_createoffer (CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_CREATEOFFER, &featdata);
|
||||
break;
|
||||
case CC_FEATURE_CREATEANSWER:
|
||||
featdata.session.sessionid = ccData.sessionid;
|
||||
featdata.session.has_constraints = ccData.has_constraints;
|
||||
featdata.session.constraints = ccData.constraints;
|
||||
cc_createanswer (CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_CREATEANSWER, data, &featdata);
|
||||
break;
|
||||
case CC_FEATURE_SETLOCALDESC:
|
||||
|
@ -914,6 +914,28 @@ fsmdef_set_per_media_local_hold_sdp (fsmdef_dcb_t *dcb)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function deallocates a constraints structure
|
||||
*
|
||||
* @param[in]constraints - pointer to cc_media_constraints_t
|
||||
* @return None
|
||||
*/
|
||||
void
|
||||
fsmdef_free_constraints(cc_media_constraints_t *constraints) {
|
||||
int i;
|
||||
|
||||
if (!constraints) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < constraints->constraint_count; i++) {
|
||||
cpr_free(constraints->constraints[i]->name);
|
||||
cpr_free(constraints->constraints[i]->value);
|
||||
}
|
||||
cpr_free(constraints->constraints);
|
||||
cpr_free(constraints);
|
||||
}
|
||||
|
||||
void
|
||||
fsmdef_init_dcb (fsmdef_dcb_t *dcb, callid_t call_id,
|
||||
fsmdef_call_types_t call_type,
|
||||
@ -2890,17 +2912,10 @@ fsmdef_ev_createoffer (sm_event_t *event) {
|
||||
}
|
||||
dcb->inbound = FALSE;
|
||||
|
||||
if (msg->data.session.has_constraints) {
|
||||
sess_data_p = (session_data_t *)findhash(msg->data.session.sessionid);
|
||||
if (sess_data_p) {
|
||||
gsmsdp_process_cap_constraints(dcb, sess_data_p->cc_constraints);
|
||||
|
||||
if (0 > delhash(msg->data.session.sessionid)) {
|
||||
FSM_DEBUG_SM (DEB_F_PREFIX"failed to delete hash sessid=0x%08x\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__), msg->data.session.sessionid);
|
||||
}
|
||||
cpr_free(sess_data_p);
|
||||
}
|
||||
if (msg->data.session.constraints) {
|
||||
gsmsdp_process_cap_constraints(dcb, msg->data.session.constraints);
|
||||
fsmdef_free_constraints(msg->data.session.constraints);
|
||||
msg->data.session.constraints = 0;
|
||||
}
|
||||
|
||||
vcmGetIceParams(dcb->peerconnection, &ufrag, &ice_pwd);
|
||||
@ -3004,17 +3019,10 @@ fsmdef_ev_createanswer (sm_event_t *event) {
|
||||
}
|
||||
dcb->inbound = TRUE;
|
||||
|
||||
if (msg->data.session.has_constraints) {
|
||||
sess_data_p = (session_data_t *)findhash(msg->data.session.sessionid);
|
||||
if (sess_data_p) {
|
||||
gsmsdp_process_cap_constraints(dcb, sess_data_p->cc_constraints);
|
||||
|
||||
if (0 > delhash(msg->data.session.sessionid)) {
|
||||
FSM_DEBUG_SM (DEB_F_PREFIX"failed to delete hash sessid=0x%08x\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__), msg->data.session.sessionid);
|
||||
}
|
||||
cpr_free(sess_data_p);
|
||||
}
|
||||
if (msg->data.session.constraints) {
|
||||
gsmsdp_process_cap_constraints(dcb, msg->data.session.constraints);
|
||||
fsmdef_free_constraints(msg->data.session.constraints);
|
||||
msg->data.session.constraints = 0;
|
||||
}
|
||||
|
||||
vcmGetIceParams(dcb->peerconnection, &ufrag, &ice_pwd);
|
||||
|
@ -208,7 +208,7 @@ void gsmsdp_process_cap_constraint(cc_media_cap_t *cap,
|
||||
* OfferToReceiveAudio, OfferToReceiveVideo
|
||||
*/
|
||||
void gsmsdp_process_cap_constraints(fsmdef_dcb_t *dcb,
|
||||
const cc_media_constraints_t* constraints) {
|
||||
cc_media_constraints_t* constraints) {
|
||||
int i = 0;
|
||||
|
||||
for (i=0; i<constraints->constraint_count; i++) {
|
||||
|
@ -131,7 +131,8 @@ void gsmsdp_add_remote_stream(uint16_t idx, int pc_stream_id, fsmdef_dcb_t * dcb
|
||||
cc_causes_t gsmsdp_install_peer_ice_attributes(fsm_fcb_t *fcb_p);
|
||||
cc_causes_t gsmsdp_configure_dtls_data_attributes(fsm_fcb_t *fcb_p);
|
||||
cc_causes_t gsmsdp_find_level_from_mid(fsmdef_dcb_t * dcb, const char * mid, uint16_t *level);
|
||||
void gsmsdp_process_cap_constraints(fsmdef_dcb_t *dcb, const cc_media_constraints_t* constraints);
|
||||
void gsmsdp_process_cap_constraints(fsmdef_dcb_t *dcb,
|
||||
cc_media_constraints_t* constraints);
|
||||
cc_causes_t
|
||||
gsmsdp_get_offered_media_types (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean *has_audio, boolean *has_video, boolean *has_data);
|
||||
fsmdef_media_t* gsmsdp_find_media_by_media_type(fsmdef_dcb_t *dcb, sdp_media_e media_type);
|
||||
|
@ -835,8 +835,7 @@ typedef struct cc_feature_candidate_t_ {
|
||||
} cc_feature_candidate_t;
|
||||
|
||||
typedef struct cc_feature_session_t_ {
|
||||
unsigned int sessionid;
|
||||
cc_boolean has_constraints;
|
||||
cc_media_constraints_t *constraints;
|
||||
} cc_feature_session_t;
|
||||
|
||||
|
||||
|
@ -47,8 +47,7 @@ typedef struct {
|
||||
cc_media_track_id_t track_id;
|
||||
cc_media_type_t media_type;
|
||||
cc_level_t level;
|
||||
unsigned int sessionid;
|
||||
cc_boolean has_constraints;
|
||||
cc_media_constraints_t * constraints;
|
||||
} ccSession_feature_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -151,9 +151,11 @@ cc_return_t CC_CallFeature_backSpace(cc_call_handle_t call_handle);
|
||||
*/
|
||||
cc_return_t CC_CallFeature_dial(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref, const cc_string_t numbers);
|
||||
|
||||
cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints);
|
||||
cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle,
|
||||
cc_media_constraints_t *constraints);
|
||||
|
||||
cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints);
|
||||
cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle,
|
||||
cc_media_constraints_t *constraints);
|
||||
|
||||
cc_return_t CC_CallFeature_SetLocalDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, const char* sdp);
|
||||
|
||||
|
@ -48,9 +48,11 @@ cc_lineid_t CCAPI_Call_getLine(cc_call_handle_t call_handle);
|
||||
cc_return_t CCAPI_Call_originateCall(cc_call_handle_t handle, cc_sdp_direction_t video_pref, cc_string_t digits);
|
||||
|
||||
|
||||
cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, const cc_media_constraints_t *constraints);
|
||||
cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle,
|
||||
cc_media_constraints_t *constraints);
|
||||
|
||||
cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle, const cc_media_constraints_t *constraints);
|
||||
cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle,
|
||||
cc_media_constraints_t *constraints);
|
||||
|
||||
cc_return_t CCAPI_SetLocalDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp);
|
||||
|
||||
|
@ -528,13 +528,13 @@ void CC_SIPCCCall::originateP2PCall (cc_sdp_direction_t video_pref, const std::s
|
||||
/*
|
||||
* This method works asynchronously, is an onCallEvent with the resulting SDP
|
||||
*/
|
||||
void CC_SIPCCCall::createOffer (const cc_media_constraints_t *constraints) {
|
||||
void CC_SIPCCCall::createOffer (cc_media_constraints_t *constraints) {
|
||||
CCAPI_CreateOffer(callHandle, constraints);
|
||||
}
|
||||
/*
|
||||
* This method works asynchronously, there is onCallEvent with the resulting SDP
|
||||
*/
|
||||
void CC_SIPCCCall::createAnswer (const cc_media_constraints_t *constraints) {
|
||||
void CC_SIPCCCall::createAnswer (cc_media_constraints_t *constraints) {
|
||||
CCAPI_CreateAnswer(callHandle, constraints);
|
||||
|
||||
}
|
||||
|
@ -110,8 +110,8 @@ namespace CSF
|
||||
virtual void removeStream(int streamId);
|
||||
virtual bool setVolume(int volume);
|
||||
virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip);
|
||||
virtual void createOffer(const cc_media_constraints_t *constraints);
|
||||
virtual void createAnswer(const cc_media_constraints_t *constraints);
|
||||
virtual void createOffer(cc_media_constraints_t *constraints);
|
||||
virtual void createAnswer(cc_media_constraints_t *constraints);
|
||||
virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp);
|
||||
virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp);
|
||||
virtual void setPeerConnection(const std::string& handle);
|
||||
|
Loading…
Reference in New Issue
Block a user