static void enable_disable_camera_after_camera_switches() { LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); const char *currentCamId = (char*)linphone_core_get_video_device(marie->lc); const char **cameras=linphone_core_get_video_devices(marie->lc); const char *newCamId=NULL; int i; video_call_base_2(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE); for (i=0;cameras[i]!=NULL;++i){ if (strcmp(cameras[i],currentCamId)!=0){ newCamId=cameras[i]; break; } } if (newCamId){ LinphoneCall *call = linphone_core_get_current_call(marie->lc); ms_message("Switching from [%s] to [%s]", currentCamId, newCamId); linphone_core_set_video_device(marie->lc, newCamId); if(call != NULL) { linphone_core_update_call(marie->lc, call, NULL); } BC_ASSERT_STRING_EQUAL(newCamId,ms_web_cam_get_string_id(linphone_call_get_video_device(call))); linphone_call_enable_camera(call,FALSE); linphone_core_iterate(marie->lc); linphone_call_enable_camera(call,TRUE); BC_ASSERT_STRING_EQUAL(newCamId,ms_web_cam_get_string_id(linphone_call_get_video_device(call))); } linphone_core_terminate_all_calls(pauline->lc); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); }
static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t caller_turn_enabled, bool_t callee_turn_enabled, bool_t rtcp_mux_enabled) { LinphoneCoreManager *marie; LinphoneCoreManager *pauline; LinphoneCall *lcall; LinphoneIceState expected_ice_state = LinphoneIceStateHostConnection; LinphoneMediaDirection expected_video_dir = LinphoneMediaDirectionInactive; bctbx_list_t *lcs = NULL; marie = linphone_core_manager_new("marie_rc"); lcs = bctbx_list_append(lcs, marie->lc); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); lcs = bctbx_list_append(lcs, pauline->lc); configure_nat_policy(marie->lc, caller_turn_enabled); configure_nat_policy(pauline->lc, callee_turn_enabled); if (forced_relay == TRUE) { linphone_core_enable_forced_ice_relay(marie->lc, TRUE); linphone_core_enable_forced_ice_relay(pauline->lc, TRUE); linphone_core_enable_short_turn_refresh(marie->lc, TRUE); linphone_core_enable_short_turn_refresh(pauline->lc, TRUE); expected_ice_state = LinphoneIceStateRelayConnection; } if (rtcp_mux_enabled == TRUE) { lp_config_set_int(linphone_core_get_config(marie->lc), "rtp", "rtcp_mux", 1); lp_config_set_int(linphone_core_get_config(pauline->lc), "rtp", "rtcp_mux", 1); } if (video_enabled) { #ifdef VIDEO_ENABLED video_call_base_2(marie, pauline, FALSE, LinphoneMediaEncryptionNone, TRUE, TRUE); expected_video_dir = LinphoneMediaDirectionSendRecv; #endif } else { BC_ASSERT_TRUE(call(marie, pauline)); } /* Wait for the ICE reINVITE to complete */ BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2)); BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); BC_ASSERT_TRUE(check_ice(pauline, marie, expected_ice_state)); check_nb_media_starts(pauline, marie, 1, 1); check_media_direction(marie, linphone_core_get_current_call(marie->lc), lcs, LinphoneMediaDirectionSendRecv, expected_video_dir); check_media_direction(pauline, linphone_core_get_current_call(pauline->lc), lcs, LinphoneMediaDirectionSendRecv, expected_video_dir); liblinphone_tester_check_rtcp(marie, pauline); lcall = linphone_core_get_current_call(marie->lc); BC_ASSERT_PTR_NOT_NULL(lcall->ice_session); if (lcall->ice_session != NULL) { IceCheckList *cl = ice_session_check_list(lcall->ice_session, 0); BC_ASSERT_PTR_NOT_NULL(cl); if (cl != NULL) { check_turn_context_statistics(cl->rtp_turn_context, forced_relay); if (!rtcp_mux_enabled) check_turn_context_statistics(cl->rtcp_turn_context, forced_relay); } } end_call(marie, pauline); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); bctbx_list_free(lcs); }