Commit 6b4c34d6 authored by Simon Morlat's avatar Simon Morlat

work in progress regarding video test, but still not functional

parent 8a9e97a2
......@@ -1190,17 +1190,23 @@ static void call_with_no_sdp_ack_without_sdp(void){
linphone_core_manager_destroy(pauline);
}
void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts) {
int check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts) {
int c1_ret = FALSE, c2_ret = FALSE;
LinphoneCall *c1 = linphone_core_get_current_call(caller->lc);
LinphoneCall *c2 = linphone_core_get_current_call(callee->lc);
BC_ASSERT_PTR_NOT_NULL(c1);
BC_ASSERT_PTR_NOT_NULL(c2);
if (!c1 || !c2) return FALSE;
if (c1) {
c1_ret = c1->nb_media_starts == caller_nb_media_starts;
BC_ASSERT_EQUAL(c1->nb_media_starts, caller_nb_media_starts, unsigned int, "%u");
}
if (c2) {
c2_ret = c2->nb_media_starts == callee_nb_media_starts;
BC_ASSERT_EQUAL(c2->nb_media_starts, callee_nb_media_starts, unsigned int, "%u");
}
return c1_ret && c2_ret;
}
void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay) {
......
......@@ -922,8 +922,8 @@ static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVide
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2)
&& wait_for(pauline->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2));
BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection));
check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts);
nb_media_starts++;
BC_ASSERT_TRUE(check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts));
if (caller_policy.automatically_initiate && callee_policy.automatically_accept && (video_added_by_caller || video_added_by_callee)){
BC_FAIL("Tired developer detected. You have requested the test to add video while it is already established from the beginning of the call.");
......@@ -939,8 +939,10 @@ static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVide
/* Wait for ICE reINVITEs to complete if video was really added */
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 4)
&& wait_for(pauline->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 4));
check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts);
/*the video addon should have triggered a media start, but the ICE reINVITE shall not*/
nb_media_starts++;
BC_ASSERT_TRUE(check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts));
}
}
}
......@@ -952,8 +954,9 @@ static void _call_with_ice_video(LinphoneVideoPolicy caller_policy, LinphoneVide
}
if (video_removed_by_caller || video_removed_by_callee) {
BC_ASSERT_TRUE(check_ice(pauline, marie, LinphoneIceStateHostConnection));
check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts);
nb_media_starts++;
BC_ASSERT_TRUE(check_nb_media_starts(pauline, marie, nb_media_starts, nb_media_starts));
}
end_call(pauline, marie);
......@@ -965,22 +968,28 @@ end:
static void call_with_ice_video_added(void) {
LinphoneVideoPolicy vpol;
vpol.automatically_initiate = vpol.automatically_accept = TRUE;
vpol.automatically_initiate = vpol.automatically_accept = FALSE;
_call_with_ice_video(vpol, vpol, TRUE, FALSE, TRUE, FALSE);
}
static void call_with_ice_video_added_2(void) {
LinphoneVideoPolicy vpol;
vpol.automatically_initiate = vpol.automatically_accept = TRUE;
vpol.automatically_initiate = vpol.automatically_accept = FALSE;
_call_with_ice_video(vpol, vpol, TRUE, FALSE, FALSE, TRUE);
}
static void call_with_ice_video_added_3(void) {
LinphoneVideoPolicy vpol;
vpol.automatically_initiate = vpol.automatically_accept = TRUE;
vpol.automatically_initiate = vpol.automatically_accept = FALSE;
_call_with_ice_video(vpol, vpol, FALSE, TRUE, TRUE, FALSE);
}
static void call_with_ice_video_added_4(void) {
LinphoneVideoPolicy vpol;
vpol.automatically_initiate = vpol.automatically_accept = FALSE;
_call_with_ice_video(vpol, vpol, FALSE, TRUE, FALSE, TRUE);
}
static void call_with_ice_video_added_and_refused(void) {
LinphoneVideoPolicy caller_policy;
LinphoneVideoPolicy callee_policy;
......@@ -1796,6 +1805,7 @@ test_t call_video_tests[] = {
TEST_ONE_TAG("Call with ICE and video added", call_with_ice_video_added, "ICE"),
TEST_ONE_TAG("Call with ICE and video added 2", call_with_ice_video_added_2, "ICE"),
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 3", call_with_ice_video_added_4, "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"),
TEST_ONE_TAG("Call with ICE and video declined then added by callee", call_with_ice_video_declined_then_added_by_callee, "ICE"),
......
......@@ -369,7 +369,7 @@ bool_t pause_call_1(LinphoneCoreManager* mgr_1,LinphoneCall* call_1,LinphoneCore
void compare_files(const char *path1, const char *path2);
void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList* lcs,LinphoneMediaDirection audio_dir, LinphoneMediaDirection video_dir);
void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports, bool_t forced_relay);
void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts);
int check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts);
void record_call(const char *filename, bool_t enableVideo, const char *video_codec);
/*
......@@ -387,7 +387,7 @@ void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, v
void liblinphone_tester_uninit(void);
int liblinphone_tester_set_log_file(const char *filename);
bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, LinphoneIceState state);
void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts);
LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bool_t do_registration);
void linphone_conference_server_destroy(LinphoneConferenceServer *conf_srv);
......
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