Commit c6b84e1c authored by Simon Morlat's avatar Simon Morlat

Merge branch 'master' of git.linphone.org:linphone

parents 5c103370 254df74f
......@@ -203,7 +203,7 @@ endif
ifeq ($(BUILD_OPENH264),1)
LOCAL_STATIC_LIBRARIES += \
libmsopenh264 \
libwels
libopenh264
endif
endif
......
......@@ -863,6 +863,10 @@ AM_CONDITIONAL([BUILD_CUNIT_TESTS], [test x$found_cunit = xyes && test x$tests_e
if test "$found_cunit" = "no" ; then
AC_MSG_WARN([Could not find cunit framework, tests are not compiled.])
else
AC_CHECK_LIB(cunit,CU_get_suite,[
AC_DEFINE(HAVE_CU_GET_SUITE,1,[defined when CU_get_suite is available])
],[foo=bar],[$CUNIT_LIBS])
AC_CHECK_LIB(cunit,CU_curses_run_tests,[
AC_DEFINE(HAVE_CU_CURSES,1,[defined when CU_curses_run_tests is available])
],[foo=bar],[$CUNIT_LIBS])
......
......@@ -97,6 +97,7 @@ static int lpc_cmd_camera(LinphoneCore *lc, char *args);
static int lpc_cmd_video_window(LinphoneCore *lc, char *args);
static int lpc_cmd_preview_window(LinphoneCore *lc, char *args);
static int lpc_cmd_snapshot(LinphoneCore *lc, char *args);
static int lpc_cmd_preview_snapshot(LinphoneCore *lc, char *args);
static int lpc_cmd_vfureq(LinphoneCore *lc, char *arg);
#endif
static int lpc_cmd_states(LinphoneCore *lc, char *args);
......@@ -312,6 +313,9 @@ static LPC_COMMAND advanced_commands[] = {
{ "snapshot", lpc_cmd_snapshot, "Take a snapshot of currently received video stream",
"'snapshot <file path>': take a snapshot and records it in jpeg format into the supplied path\n"
},
{ "preview-snapshot", lpc_cmd_preview_snapshot, "Take a snapshot of currently captured video stream",
"'preview-snapshot <file path>': take a snapshot and records it in jpeg format into the supplied path\n"
},
{ "vfureq", lpc_cmd_vfureq, "Request the other side to send VFU for the current call"},
#endif
{ "states", lpc_cmd_states, "Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions",
......@@ -2548,6 +2552,17 @@ static int lpc_cmd_snapshot(LinphoneCore *lc, char *args){
return 1;
}
static int lpc_cmd_preview_snapshot(LinphoneCore *lc, char *args){
LinphoneCall *call;
if (!args) return 0;
call=linphone_core_get_current_call(lc);
if (call!=NULL){
linphone_call_take_preview_snapshot(call,args);
linphonec_out("Taking video preview snapshot in file %s\n", args);
}else linphonec_out("There is no active call.\n");
return 1;
}
static int lpc_cmd_vfureq(LinphoneCore *lc, char *arg){
LinphoneCall *call;
call=linphone_core_get_current_call(lc);
......
......@@ -170,12 +170,14 @@ make_gitversion_h:
$(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(GITDESCRIBE)\"" > $(GITVERSION_FILE_TMP) ; \
elif test "$(GITREVISION)" != "" ; then \
$(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(LINPHONE_VERSION)_$(GITREVISION)\"" > $(GITVERSION_FILE_TMP) ; \
else \
$(ECHO) -n "" > $(GITVERSION_FILE_TMP) ; \
fi ; \
else \
$(ECHO) -n "" > $(GITVERSION_FILE_TMP) ; \
fi
if test ! -f $(srcdir)/$(GITVERSION_FILE) ; then \
cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \
if ! test -f $(srcdir)/$(GITVERSION_FILE) ; then \
cp -f $(srcdir)/$(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \
fi
if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \
cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \
......
......@@ -1035,6 +1035,8 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
if (vstream != NULL) {
call->current_params.sent_vsize = video_stream_get_sent_video_size(vstream);
call->current_params.recv_vsize = video_stream_get_received_video_size(vstream);
call->current_params.sent_fps = video_stream_get_sent_framerate(vstream);
call->current_params.received_fps = video_stream_get_received_framerate(vstream);
}
#endif
......@@ -1287,6 +1289,10 @@ void linphone_call_send_vfu_request(LinphoneCall *call)
/**
* Take a photo of currently received video and write it into a jpeg file.
* Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
* @param call a LinphoneCall
* @param file a path where to write the jpeg content.
* @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
**/
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){
#ifdef VIDEO_ENABLED
......@@ -1299,6 +1305,24 @@ int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){
return -1;
}
/**
* Take a photo of currently captured video and write it into a jpeg file.
* Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
* @param call a LinphoneCall
* @param file a path where to write the jpeg content.
* @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
**/
int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file){
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL && call->videostream->local_jpegwriter!=NULL){
return ms_filter_call_method(call->videostream->local_jpegwriter,MS_JPEG_WRITER_TAKE_SNAPSHOT,(void*)file);
}
ms_warning("Cannot take local snapshot: no currently running video stream on this call.");
return -1;
#endif
return -1;
}
/**
* Returns TRUE if camera pictures are allowed to be sent to the remote party.
**/
......@@ -1336,6 +1360,24 @@ MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParam
return cp->recv_vsize;
}
/**
* Gets the framerate of the video that is sent.
* @param[in] cp The call parameters.
* @return the actual sent framerate in frames per seconds, 0 if not available.
*/
float linphone_call_params_get_sent_framerate(const LinphoneCallParams *cp){
return cp->sent_fps;
}
/**
* Gets the framerate of the video that is received.
* @param[in] cp The call paramaters for which to get the received framerate.
* @return the actual received framerate in frames per seconds, 0 if not available.
*/
float linphone_call_params_get_received_framerate(const LinphoneCallParams *cp){
return cp->received_fps;
}
const char * linphone_call_params_get_rtp_profile(const LinphoneCallParams *cp) {
return sal_media_proto_to_string(get_proto_from_call_params(cp));
}
......@@ -2147,6 +2189,9 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
video_stream_enable_adaptive_bitrate_control(call->videostream,
linphone_core_adaptive_rate_control_enabled(lc));
video_stream_enable_adaptive_jittcomp(call->videostream, linphone_core_video_adaptive_jittcomp_enabled(lc));
if (lc->video_conf.preview_vsize.width!=0)
video_stream_set_preview_size(call->videostream,lc->video_conf.preview_vsize);
video_stream_set_fps(call->videostream,linphone_core_get_preferred_framerate(lc));
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
if (lc->video_window_id!=0)
......
......@@ -997,6 +997,11 @@ static void video_config_read(LinphoneCore *lc){
linphone_core_set_preferred_video_size_by_name(lc,
lp_config_get_string(lc->config,"video","size","cif"));
linphone_core_set_preview_video_size_by_name(lc,
lp_config_get_string(lc->config,"video","preview_size",NULL));
linphone_core_set_preferred_framerate(lc,lp_config_get_float(lc->config,"video","framerate",0));
#ifdef VIDEO_ENABLED
#if defined(ANDROID) || defined(__ios)
......@@ -4792,12 +4797,14 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){
if (val){
if (lc->previewstream==NULL){
const char *display_filter=linphone_core_get_video_display_filter(lc);
MSVideoSize vsize=lc->video_conf.preview_vsize.width!=0 ? lc->video_conf.preview_vsize : lc->video_conf.vsize;
lc->previewstream=video_preview_new();
video_preview_set_size(lc->previewstream,lc->video_conf.vsize);
video_preview_set_size(lc->previewstream,vsize);
if (display_filter)
video_preview_set_display_filter_name(lc->previewstream,display_filter);
if (lc->preview_window_id!=0)
video_preview_set_native_window_id(lc->previewstream,lc->preview_window_id);
video_preview_set_fps(lc->previewstream,linphone_core_get_preferred_framerate(lc));
video_preview_start(lc->previewstream,lc->video_conf.device);
}
}else{
......@@ -5284,6 +5291,7 @@ const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc){
static MSVideoSize video_size_get_by_name(const char *name){
MSVideoSizeDef *pdef=supported_resolutions;
MSVideoSize null_vsize={0,0};
if (!name) return null_vsize;
for(;pdef->name!=NULL;pdef++){
if (strcasecmp(name,pdef->name)==0){
return pdef->vsize;
......@@ -5309,6 +5317,13 @@ static bool_t video_size_supported(MSVideoSize vsize){
return FALSE;
}
static void update_preview_size(LinphoneCore *lc, MSVideoSize oldvsize, MSVideoSize vsize){
if (!ms_video_size_equal(oldvsize,vsize) && lc->previewstream!=NULL){
toggle_video_preview(lc,FALSE);
toggle_video_preview(lc,TRUE);
}
}
/**
* Sets the preferred video size.
*
......@@ -5318,17 +5333,57 @@ static bool_t video_size_supported(MSVideoSize vsize){
**/
void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize){
if (video_size_supported(vsize)){
MSVideoSize oldvsize=lc->video_conf.vsize;
MSVideoSize oldvsize=lc->video_conf.preview_vsize;
if (oldvsize.width==0){
oldvsize=lc->video_conf.vsize;
update_preview_size(lc,oldvsize,vsize);
}
lc->video_conf.vsize=vsize;
if (linphone_core_ready(lc))
lp_config_set_string(lc->config,"video","size",video_size_get_name(vsize));
}
}
/**
* Sets the video size for the captured (preview) video.
* This method is for advanced usage where a video capture must be set independently of the size of the stream actually sent through the call.
* This allows for example to have the preview window with HD resolution even if due to bandwidth constraint the sent video size is small.
* Using this feature increases the CPU consumption, since a rescaling will be done internally.
* @ingroup media_parameters
* @param lc the linphone core
* @param vsize the video resolution choosed for capuring and previewing. It can be (0,0) to not request any specific preview size and let the core optimize the processing.
**/
void linphone_core_set_preview_video_size(LinphoneCore *lc, MSVideoSize vsize){
if (vsize.width==0 && vsize.height==0){
/*special case to reset the forced preview size mode*/
lc->video_conf.preview_vsize=vsize;
if (linphone_core_ready(lc))
lp_config_set_string(lc->config,"video","preview_size",NULL);
return;
}
if (video_size_supported(vsize)){
MSVideoSize oldvsize=lc->video_conf.preview_vsize;
lc->video_conf.preview_vsize=vsize;
if (!ms_video_size_equal(oldvsize,vsize) && lc->previewstream!=NULL){
toggle_video_preview(lc,FALSE);
toggle_video_preview(lc,TRUE);
}
if ( linphone_core_ready(lc))
lp_config_set_string(lc->config,"video","size",video_size_get_name(vsize));
if (linphone_core_ready(lc))
lp_config_set_string(lc->config,"video","preview_size",video_size_get_name(vsize));
}
}
/**
* Sets the preview video size by its name. See linphone_core_set_preview_video_size() for more information about this feature.
*
* @ingroup media_parameters
* Video resolution names are: qcif, svga, cif, vga, 4cif, svga ...
**/
void linphone_core_set_preview_video_size_by_name(LinphoneCore *lc, const char *name){
MSVideoSize vsize=video_size_get_by_name(name);
linphone_core_set_preview_video_size(lc,vsize);
}
/**
* Sets the preferred video size by its name.
*
......@@ -5353,6 +5408,30 @@ MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc){
return lc->video_conf.vsize;
}
/**
* Set the preferred frame rate for video.
* Based on the available bandwidth constraints and network conditions, the video encoder
* remains free to lower the framerate. There is no warranty that the preferred frame rate be the actual framerate.
* used during a call. Default value is 0, which means "use encoder's default fps value".
* @ingroup media_parameters
* @param lc the LinphoneCore
* @param fps the target frame rate in number of frames per seconds.
**/
void linphone_core_set_preferred_framerate(LinphoneCore *lc, float fps){
lc->video_conf.fps=fps;
if (linphone_core_ready(lc))
lp_config_set_float(lc->config,"video","framerate",fps);
}
/**
* Returns the preferred video framerate, previously set by linphone_core_set_preferred_framerate().
* @param lc the linphone core
* @return frame rate in number of frames per seconds.
**/
float linphone_core_get_preferred_framerate(LinphoneCore *lc){
return lc->video_conf.fps;
}
/**
* Ask the core to stream audio from and to files, instead of using the soundcard.
**/
......
......@@ -431,6 +431,21 @@ LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_sent_video_size(const Linph
*/
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *cp);
/**
* Gets the framerate of the video that is sent.
* @param[in] cp The call parameters.
* @return the actual sent framerate in frames per seconds, 0 if not available.
*/
LINPHONE_PUBLIC float linphone_call_params_get_sent_framerate(const LinphoneCallParams *cp);
/**
* Gets the framerate of the video that is received.
* @param[in] cp The call paramaters for which to get the received framerate.
* @return the actual received framerate in frames per seconds, 0 if not available.
*/
LINPHONE_PUBLIC float linphone_call_params_get_received_framerate(const LinphoneCallParams *cp);
/**
* Gets the RTP profile being used.
* @param[in] cp #LinphoneCallParams object
......@@ -689,6 +704,7 @@ LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_remote_params(Linph
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
LINPHONE_PUBLIC int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
LINPHONE_PUBLIC int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file);
LINPHONE_PUBLIC LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call);
LINPHONE_PUBLIC const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
......@@ -2227,9 +2243,12 @@ typedef struct MSVideoSizeDef{
/* returns a zero terminated table of MSVideoSizeDef*/
LINPHONE_PUBLIC const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize);
LINPHONE_PUBLIC void linphone_core_set_preview_video_size(LinphoneCore *lc, MSVideoSize vsize);
LINPHONE_PUBLIC void linphone_core_set_preview_video_size_by_name(LinphoneCore *lc, const char *name);
LINPHONE_PUBLIC MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name);
LINPHONE_PUBLIC void linphone_core_set_preferred_framerate(LinphoneCore *lc, float fps);
LINPHONE_PUBLIC float linphone_core_get_preferred_framerate(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val);
LINPHONE_PUBLIC bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc);
......
......@@ -87,6 +87,7 @@ struct _LinphoneCallParams{
PayloadType *video_codec; /*video codec currently in use */
MSVideoSize sent_vsize; /* Size of the video currently being sent */
MSVideoSize recv_vsize; /* Size of the video currently being received */
float received_fps,sent_fps;
int down_bw;
int up_bw;
int down_ptime;
......@@ -591,6 +592,8 @@ typedef struct video_config{
struct _MSWebCam *device;
const char **cams;
MSVideoSize vsize;
MSVideoSize preview_vsize; /*is 0,0 if no forced preview size is set, in which case vsize field above is used.*/
float fps;
bool_t capture;
bool_t show_local;
bool_t display;
......
......@@ -256,10 +256,11 @@ static void _refresh_call_stats(GtkWidget *callstats, LinphoneCall *call){
const LinphoneCallStats *vs=linphone_call_get_video_stats(call);
const char *audio_media_connectivity = _("Direct or through server");
const char *video_media_connectivity = _("Direct or through server");
gboolean has_video=linphone_call_params_video_enabled(linphone_call_get_current_params(call));
MSVideoSize size_received = linphone_call_params_get_received_video_size(linphone_call_get_current_params(call));
MSVideoSize size_sent = linphone_call_params_get_sent_video_size(linphone_call_get_current_params(call));
const char *rtp_profile = linphone_call_params_get_rtp_profile(linphone_call_get_current_params(call));
const LinphoneCallParams *curparams=linphone_call_get_current_params(call);
gboolean has_video=linphone_call_params_video_enabled(curparams);
MSVideoSize size_received = linphone_call_params_get_received_video_size(curparams);
MSVideoSize size_sent = linphone_call_params_get_sent_video_size(curparams);
const char *rtp_profile = linphone_call_params_get_rtp_profile(curparams);
gchar *tmp = g_strdup_printf("%s", rtp_profile);
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"rtp_profile")),tmp);
g_free(tmp);
......@@ -268,8 +269,10 @@ static void _refresh_call_stats(GtkWidget *callstats, LinphoneCall *call){
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"audio_bandwidth_usage")),tmp);
g_free(tmp);
if (has_video){
gchar *size_r=g_strdup_printf(_("%ix%i"),size_received.width,size_received.height);
gchar *size_s=g_strdup_printf(_("%ix%i"),size_sent.width,size_sent.height);
gchar *size_r=g_strdup_printf(_("%ix%i @ %f fps"),size_received.width,size_received.height,
linphone_call_params_get_received_framerate(curparams));
gchar *size_s=g_strdup_printf(_("%ix%i @ %f fps"),size_sent.width,size_sent.height,
linphone_call_params_get_sent_framerate(curparams));
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"video_size_recv")),size_r);
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"video_size_sent")),size_s);
......
mediastreamer2 @ 6d75b63a
Subproject commit 5313bf3a57474411efce3b8f60a8c7190554a619
Subproject commit 6d75b63ac302fbcabe9aab003d6c1174441982a1
oRTP @ 9aae6334
Subproject commit 9d03c3aa1643f1cfae32de4abf04dc84ff3ad175
Subproject commit 9aae6334aa4268954e32c7a3382e2dbc40b215d0
......@@ -125,7 +125,8 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana
CU_ASSERT_PTR_NOT_NULL(c2);
if (!c1 || !c2) return;
linphone_call_ref(c1);
linphone_call_ref(c2);
for (i=0; i<24 /*=12s need at least one exchange of SR to maybe 10s*/; i++) {
if (linphone_call_get_audio_stats(c1)->round_trip_delay >0.0
&& linphone_call_get_audio_stats(c2)->round_trip_delay >0.0
......@@ -145,7 +146,8 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana
if (linphone_call_log_video_enabled(linphone_call_get_call_log(c2))) {
CU_ASSERT_TRUE(linphone_call_get_video_stats(c2)->round_trip_delay>0.0);
}
linphone_call_unref(c1);
linphone_call_unref(c2);
}
bool_t call_with_params(LinphoneCoreManager* caller_mgr
......@@ -723,6 +725,10 @@ static bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee
CU_ASSERT_PTR_NOT_NULL(c1);
CU_ASSERT_PTR_NOT_NULL(c2);
if (!c1 || !c2) return FALSE;
linphone_call_ref(c1);
linphone_call_ref(c2);
CU_ASSERT_EQUAL(linphone_call_params_video_enabled(linphone_call_get_current_params(c1)),linphone_call_params_video_enabled(linphone_call_get_current_params(c2)));
video_enabled=linphone_call_params_video_enabled(linphone_call_get_current_params(c1));
for (i=0;i<200;i++){
......@@ -762,7 +768,8 @@ static bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee
const LinphoneCallParams* call_param = linphone_call_get_current_params(c2);
CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(callee->lc));
}
linphone_call_unref(c1);
linphone_call_unref(c2);
return video_enabled ? audio_success && video_success : audio_success;
}
......@@ -919,25 +926,45 @@ static void call_with_custom_headers(void) {
static void call_paused_resumed(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCall* call_obj;
LinphoneCall* call_pauline;
const rtp_stats_t * stats;
CU_ASSERT_TRUE(call(pauline,marie));
call_obj = linphone_core_get_current_call(pauline->lc);
call_pauline = linphone_core_get_current_call(pauline->lc);
linphone_core_pause_call(pauline->lc,call_obj);
wait_for_until(pauline->lc, marie->lc, NULL, 5, 3000);
int exp_cum = - rtp_session_get_rcv_ext_seq_number(call_pauline->audiostream->ms.sessions.rtp_session);
linphone_core_pause_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1));
linphone_core_resume_call(pauline->lc,call_obj);
exp_cum += rtp_session_get_seq_number(linphone_core_get_current_call(marie->lc)->audiostream->ms.sessions.rtp_session);
/*stay in pause a little while in order to generate traffic*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
linphone_core_resume_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
/*same here: wait a while for a bit of a traffic, we need to receive a RTCP packet*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000);
/*there should be a bit of packets loss for the ones sent by PAUSED (pauline) between the latest RTCP SR report received
by PAUSER (marie) because PAUSER will drop any packets received after the pause. Keep a tolerance of 1 more packet lost
in case of ...*/
stats = rtp_session_get_stats(call_pauline->sessions->rtp_session);
CU_ASSERT_TRUE(abs(stats->cum_packet_loss - exp_cum)<=1);
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
......@@ -989,8 +1016,8 @@ static bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee)
stats initial_caller_stat=caller->stat;
stats initial_callee_stat=callee->stat;
if (linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning
|| linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning ) {
if (!linphone_core_get_current_call(callee->lc) || linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning
|| !linphone_core_get_current_call(caller->lc) || linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning ) {
ms_warning("bad state for adding video");
return FALSE;
}
......@@ -1077,23 +1104,36 @@ static void call_with_video_added_random_ports(void) {
linphone_core_manager_destroy(pauline);
}
static void call_with_declined_video(void) {
static void call_with_declined_video_base(bool_t using_policy) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCallParams* callee_params;
LinphoneCallParams* caller_params;
LinphoneCall* marie_call;
LinphoneCall* pauline_call;
LinphoneVideoPolicy marie_policy, pauline_policy;
linphone_core_enable_video_capture(marie->lc, TRUE);
linphone_core_enable_video_display(marie->lc, TRUE);
linphone_core_enable_video_capture(pauline->lc, TRUE);
linphone_core_enable_video_display(pauline->lc, FALSE);
caller_params=linphone_core_create_default_call_parameters(marie->lc);
linphone_call_params_enable_video(caller_params,TRUE);
callee_params=linphone_core_create_default_call_parameters(pauline->lc);
linphone_call_params_enable_video(callee_params,FALSE);
if (using_policy) {
pauline_policy.automatically_initiate=TRUE;
pauline_policy.automatically_accept=FALSE;
marie_policy.automatically_initiate=FALSE;
marie_policy.automatically_accept=FALSE;
linphone_core_set_video_policy(marie->lc,&marie_policy);
linphone_core_set_video_policy(pauline->lc,&pauline_policy);
}
caller_params=linphone_core_create_default_call_parameters(pauline->lc);
if (!using_policy)
linphone_call_params_enable_video(caller_params,TRUE);
callee_params=linphone_core_create_default_call_parameters(marie->lc);
if (!using_policy)
linphone_call_params_enable_video(callee_params,FALSE);
CU_ASSERT_TRUE(call_with_params(pauline,marie,caller_params,callee_params));
marie_call=linphone_core_get_current_call(marie->lc);
pauline_call=linphone_core_get_current_call(pauline->lc);
......@@ -1109,22 +1149,41 @@ static void call_with_declined_video(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void call_with_declined_video(void) {
call_with_declined_video_base(FALSE);
}
static void call_with_declined_video_using_policy(void) {
call_with_declined_video_base(TRUE);
}
static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie) {
static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy) {
LinphoneCallParams* callee_params;
LinphoneCallParams* caller_params;
LinphoneCall* marie_call;
LinphoneCall* pauline_call;
LinphoneVideoPolicy marie_policy, pauline_policy;
linphone_core_enable_video_capture(marie->lc, TRUE);
linphone_core_enable_video_display(marie->lc, TRUE);
linphone_core_enable_video_capture(pauline->lc, TRUE);
linphone_core_enable_video_display(pauline->lc, FALSE);
caller_params=linphone_core_create_default_call_parameters(marie->lc);
linphone_call_params_enable_video(caller_params,TRUE);
callee_params=linphone_core_create_default_call_parameters(pauline->lc);
linphone_call_params_enable_video(callee_params,TRUE);
if (using_policy) {
marie_policy.automatically_initiate=FALSE;
marie_policy.automatically_accept=TRUE;
pauline_policy.automatically_initiate=TRUE;
pauline_policy.automatically_accept=FALSE;
linphone_core_set_video_policy(marie->lc,&marie_policy);
linphone_core_set_video_policy(pauline->lc,&pauline_policy);
}
caller_params=linphone_core_create_default_call_parameters(pauline->lc);
if (!using_policy)
linphone_call_params_enable_video(caller_params,TRUE);
callee_params=linphone_core_create_default_call_parameters(marie->lc);
if (!using_policy)
linphone_call_params_enable_video(callee_params,TRUE);
CU_ASSERT_TRUE(call_with_params(pauline,marie,caller_params,callee_params));
marie_call=linphone_core_get_current_call(marie->lc);
pauline_call=linphone_core_get_current_call(pauline->lc);
......@@ -1152,15 +1211,24 @@ static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* ma
static void video_call(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
video_call_base(marie,pauline);
video_call_base(marie,pauline,FALSE);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void video_call_using_policy(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
video_call_base(marie,pauline,TRUE);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void video_call_no_sdp(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
linphone_core_enable_sdp_200_ack(pauline->lc,TRUE);
video_call_base(pauline,marie);
video_call_base(pauline,marie,FALSE);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);