forked from mirrors/linphone-iphone
fix crash in publish without expires
This commit is contained in:
parent
d6e44b60e8
commit
2c01e3f61f
4 changed files with 10 additions and 21 deletions
|
|
@ -133,14 +133,9 @@ void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState s
|
|||
linphone_core_notify_publish_state_changed(lev->lc,lev,state);
|
||||
switch(state){
|
||||
case LinphonePublishCleared:
|
||||
if (lev->expires!=-1){
|
||||
linphone_event_release(lev);
|
||||
}
|
||||
linphone_event_release(lev);
|
||||
break;
|
||||
case LinphonePublishOk:
|
||||
if (lev->expires==-1){
|
||||
linphone_event_release(lev);
|
||||
}
|
||||
break;
|
||||
case LinphonePublishError:
|
||||
linphone_event_release(lev);
|
||||
|
|
@ -200,7 +195,7 @@ int linphone_event_send_subscribe(LinphoneEvent *lev, const LinphoneContent *bod
|
|||
switch (lev->subscription_state){
|
||||
case LinphoneSubscriptionIncomingReceived:
|
||||
case LinphoneSubscriptionTerminated:
|
||||
case LinphoneSubscriptionOutgoingInit:
|
||||
case LinphoneSubscriptionOutgoingProgress:
|
||||
ms_error("linphone_event_send_subscribe(): cannot update subscription while in state [%s]", linphone_subscription_state_to_string(lev->subscription_state));
|
||||
return -1;
|
||||
break;
|
||||
|
|
@ -223,7 +218,7 @@ int linphone_event_send_subscribe(LinphoneEvent *lev, const LinphoneContent *bod
|
|||
err=sal_subscribe(lev->op,NULL,NULL,lev->name,lev->expires,body_handler);
|
||||
if (err==0){
|
||||
if (lev->subscription_state==LinphoneSubscriptionNone)
|
||||
linphone_event_set_state(lev,LinphoneSubscriptionOutgoingInit);
|
||||
linphone_event_set_state(lev,LinphoneSubscriptionOutgoingProgress);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
|
@ -372,8 +367,8 @@ void linphone_event_terminate(LinphoneEvent *lev){
|
|||
|
||||
if (lev->publish_state!=LinphonePublishNone){
|
||||
if (lev->publish_state==LinphonePublishOk && lev->expires!=-1){
|
||||
sal_publish(lev->op,NULL,NULL,NULL,0,NULL);
|
||||
}else sal_op_unpublish(lev->op);
|
||||
sal_op_unpublish(lev->op);
|
||||
}
|
||||
linphone_event_set_publish_state(lev,LinphonePublishCleared);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ typedef enum _LinphoneSubscriptionDir LinphoneSubscriptionDir;
|
|||
|
||||
/**
|
||||
* Enum for subscription states.
|
||||
* LinphoneSubscriptionTerminated and LinphoneSubscriptionError are final states.
|
||||
**/
|
||||
enum _LinphoneSubscriptionState{
|
||||
LinphoneSubscriptionNone, /**< Initial state, should not be used.**/
|
||||
|
|
@ -57,13 +58,10 @@ enum _LinphoneSubscriptionState{
|
|||
LinphoneSubscriptionPending, /**<Subscription is pending, waiting for user approval*/
|
||||
LinphoneSubscriptionActive, /**<Subscription is accepted.*/
|
||||
LinphoneSubscriptionTerminated, /**<Subscription is terminated normally*/
|
||||
LinphoneSubscriptionError, /**<Subscription encountered an error, indicated by linphone_event_get_reason()*/
|
||||
LinphoneSubscriptionError, /**<Subscription was terminated by an error, indicated by linphone_event_get_reason().*/
|
||||
LinphoneSubscriptionExpiring, /**<Subscription is about to expire, only sent if [sip]->refresh_generic_subscribe property is set to 0.*/
|
||||
};
|
||||
/*typo compatibility*/
|
||||
#define LinphoneSubscriptionOutoingInit LinphoneSubscriptionOutgoingInit
|
||||
|
||||
#define LinphoneSubscriptionOutgoingInit LinphoneSubscriptionOutgoingProgress
|
||||
/**
|
||||
* Typedef for subscription state enum.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -954,8 +954,6 @@ static void call_with_ice_video_added_with_video_policies_to_false(void) {
|
|||
_call_with_ice_video(vpol, vpol, FALSE, TRUE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
#if ICE_WAS_WORKING_WITH_REAL_TIME_TEXT /*which is not the case at the moment*/
|
||||
|
||||
static void call_with_ice_video_and_rtt(void) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
|
|
@ -980,7 +978,7 @@ static void call_with_ice_video_and_rtt(void) {
|
|||
linphone_core_set_video_port(pauline->lc, -1);
|
||||
linphone_core_set_text_port(pauline->lc, -1);
|
||||
|
||||
params = linphone_core_create_default_call_parameters(pauline->lc);
|
||||
params = linphone_core_create_call_params(pauline->lc, NULL);
|
||||
linphone_call_params_enable_realtime_text(params, TRUE);
|
||||
BC_ASSERT_TRUE(call_ok = call_with_caller_params(pauline, marie, params));
|
||||
if (!call_ok) goto end;
|
||||
|
|
@ -998,7 +996,6 @@ end:
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void video_call_with_early_media_no_matching_audio_codecs(void) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
|
|
@ -1750,9 +1747,7 @@ test_t call_video_tests[] = {
|
|||
TEST_ONE_TAG("Call with ICE and video added 3", call_with_ice_video_added_3, "ICE"),
|
||||
TEST_ONE_TAG("Call with ICE and video added and refused", call_with_ice_video_added_and_refused, "ICE"),
|
||||
TEST_ONE_TAG("Call with ICE and video added with video policies to false", call_with_ice_video_added_with_video_policies_to_false, "ICE"),
|
||||
#if ICE_WAS_WORKING_WITH_REAL_TIME_TEXT
|
||||
TEST_ONE_TAG("Call with ICE, video and realtime text", call_with_ice_video_and_rtt, "ICE"),
|
||||
#endif
|
||||
TEST_ONE_TAG("Video call with ICE accepted using call params", video_call_ice_params, "ICE"),
|
||||
TEST_ONE_TAG("Audio call with ICE paused with caller video policy enabled", audio_call_with_ice_with_video_policy_enabled, "ICE"),
|
||||
TEST_NO_TAG("Video call recording (H264)", video_call_recording_h264_test),
|
||||
|
|
|
|||
|
|
@ -436,8 +436,9 @@ static void publish_test_with_args(bool_t refresh, int expires){
|
|||
|
||||
lev=linphone_core_create_publish(marie->lc,pauline->identity,"dodo",expires);
|
||||
linphone_event_add_custom_header(lev,"CustomHeader","someValue");
|
||||
linphone_event_send_publish(lev,content);
|
||||
linphone_event_ref(lev);
|
||||
linphone_event_send_publish(lev,content);
|
||||
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue