mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-23 14:18:07 +00:00
Add video support to the "Call recording" test
This commit is contained in:
parent
0046baac1b
commit
7ec17111b0
2 changed files with 44 additions and 25 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 2af3b2c257c21278aa1b08fbb0f8a15da14f5471
|
||||
Subproject commit e3fe44b86513914192078d2096d83592cfeb41ff
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
#include "liblinphone_tester.h"
|
||||
|
||||
static void call_base(LinphoneMediaEncryption mode, bool_t enable_video,bool_t enable_relay,LinphoneFirewallPolicy policy);
|
||||
static void disable_all_codecs_except_one(LinphoneCore *lc, const char *mime);
|
||||
static void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime);
|
||||
|
||||
void call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg){
|
||||
char* to=linphone_address_as_string(linphone_call_get_call_log(call)->to);
|
||||
|
|
@ -427,8 +427,8 @@ static void call_with_specified_codec_bitrate(void) {
|
|||
goto end;
|
||||
}
|
||||
|
||||
disable_all_codecs_except_one(marie->lc,"opus");
|
||||
disable_all_codecs_except_one(pauline->lc,"opus");
|
||||
disable_all_audio_codecs_except_one(marie->lc,"opus");
|
||||
disable_all_audio_codecs_except_one(pauline->lc,"opus");
|
||||
|
||||
linphone_core_set_payload_type_bitrate(marie->lc,
|
||||
linphone_core_find_payload_type(marie->lc,"opus",48000,-1),
|
||||
|
|
@ -537,7 +537,7 @@ static void cancelled_call(void) {
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void disable_all_codecs_except_one(LinphoneCore *lc, const char *mime){
|
||||
static void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime){
|
||||
const MSList *elem=linphone_core_get_audio_codecs(lc);
|
||||
PayloadType *pt;
|
||||
|
||||
|
|
@ -550,13 +550,25 @@ static void disable_all_codecs_except_one(LinphoneCore *lc, const char *mime){
|
|||
linphone_core_enable_payload_type(lc,pt,TRUE);
|
||||
}
|
||||
|
||||
static void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime) {
|
||||
const MSList *codecs = linphone_core_get_video_codecs(lc);
|
||||
const MSList *it = NULL;
|
||||
PayloadType *pt = NULL;
|
||||
|
||||
for(it = codecs; it != NULL; it = it->next) {
|
||||
linphone_core_enable_payload_type(lc, (PayloadType *)it->data, FALSE);
|
||||
}
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(pt = linphone_core_find_payload_type(lc, mime, -1, -1));
|
||||
linphone_core_enable_payload_type(lc, pt, TRUE);
|
||||
}
|
||||
|
||||
static void call_failed_because_of_codecs(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
LinphoneCall* out_call;
|
||||
|
||||
disable_all_codecs_except_one(marie->lc,"pcmu");
|
||||
disable_all_codecs_except_one(pauline->lc,"pcma");
|
||||
disable_all_audio_codecs_except_one(marie->lc,"pcmu");
|
||||
disable_all_audio_codecs_except_one(pauline->lc,"pcma");
|
||||
out_call = linphone_core_invite(pauline->lc,"marie");
|
||||
linphone_call_ref(out_call);
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1));
|
||||
|
|
@ -1913,8 +1925,8 @@ static void early_media_call_with_update_base(bool_t media_change){
|
|||
lcs = ms_list_append(lcs,marie->lc);
|
||||
lcs = ms_list_append(lcs,pauline->lc);
|
||||
if (media_change) {
|
||||
disable_all_codecs_except_one(marie->lc,"pcmu");
|
||||
disable_all_codecs_except_one(pauline->lc,"pcmu");
|
||||
disable_all_audio_codecs_except_one(marie->lc,"pcmu");
|
||||
disable_all_audio_codecs_except_one(pauline->lc,"pcmu");
|
||||
|
||||
}
|
||||
/*
|
||||
|
|
@ -1939,8 +1951,8 @@ static void early_media_call_with_update_base(bool_t media_change){
|
|||
pauline_params = linphone_call_params_copy(linphone_call_get_current_params(pauline_call));
|
||||
|
||||
if (media_change) {
|
||||
disable_all_codecs_except_one(marie->lc,"pcma");
|
||||
disable_all_codecs_except_one(pauline->lc,"pcma");
|
||||
disable_all_audio_codecs_except_one(marie->lc,"pcma");
|
||||
disable_all_audio_codecs_except_one(pauline->lc,"pcma");
|
||||
}
|
||||
#define UPDATED_SESSION_NAME "nouveau nom de session"
|
||||
|
||||
|
|
@ -2649,10 +2661,11 @@ static void savpf_to_savpf_call(void) {
|
|||
profile_call(TRUE, TRUE, TRUE, TRUE, "RTP/SAVPF");
|
||||
}
|
||||
|
||||
static void call_recording() {
|
||||
LinphoneCoreManager *marie = NULL, *pauline = NULL;
|
||||
LinphoneCallParams *params = NULL;
|
||||
const MSList *calls = NULL;
|
||||
static void recording_call() {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc");
|
||||
LinphoneCallParams *marieParams = linphone_core_create_default_call_parameters(marie->lc);
|
||||
LinphoneCallParams *paulineParams = linphone_core_create_default_call_parameters(pauline->lc);
|
||||
LinphoneCall *callInst = NULL;
|
||||
const char filename[] = "recording.mkv";
|
||||
const char dirname[] = ".test";
|
||||
|
|
@ -2670,17 +2683,23 @@ static void call_recording() {
|
|||
CU_ASSERT_EQUAL(remove(filepath), 0);
|
||||
}
|
||||
|
||||
marie = linphone_core_manager_new("marie_rc");
|
||||
pauline = linphone_core_manager_new("pauline_rc");
|
||||
params = linphone_core_create_default_call_parameters(marie->lc);
|
||||
linphone_call_params_set_record_file(params, filepath);
|
||||
linphone_core_enable_video_display(marie->lc, TRUE);
|
||||
linphone_core_enable_video_display(pauline->lc, FALSE);
|
||||
linphone_core_enable_video_capture(marie->lc, TRUE);
|
||||
linphone_core_enable_video_capture(pauline->lc, TRUE);
|
||||
|
||||
linphone_call_params_enable_video(marieParams, TRUE);
|
||||
linphone_call_params_set_record_file(marieParams, filepath);
|
||||
linphone_call_params_enable_video(paulineParams, TRUE);
|
||||
|
||||
disable_all_video_codecs_except_one(marie->lc, "H264");
|
||||
disable_all_video_codecs_except_one(pauline->lc, "H264");
|
||||
|
||||
CU_ASSERT_TRUE(call_with_params(marie, pauline, marieParams, paulineParams));
|
||||
CU_ASSERT_PTR_NOT_NULL(callInst = linphone_core_get_current_call(marie->lc));
|
||||
|
||||
CU_ASSERT_TRUE(call_with_caller_params(marie, pauline, params));
|
||||
calls = linphone_core_get_calls(marie->lc);
|
||||
CU_ASSERT_PTR_NOT_NULL(calls);
|
||||
callInst = (LinphoneCall *)calls->data;
|
||||
linphone_call_start_recording(callInst);
|
||||
sleep(2);
|
||||
sleep(20);
|
||||
linphone_call_stop_recording(callInst);
|
||||
|
||||
CU_ASSERT_EQUAL(access(filepath, F_OK), 0);
|
||||
|
|
@ -2780,7 +2799,7 @@ test_t call_tests[] = {
|
|||
{ "SAVPF to AVPF call", savpf_to_avpf_call },
|
||||
{ "SAVPF to SAVP call", savpf_to_savp_call },
|
||||
{ "SAVPF to SAVPF call", savpf_to_savpf_call },
|
||||
{ "Call recording", call_recording }
|
||||
{ "Call recording", recording_call }
|
||||
};
|
||||
|
||||
test_suite_t call_test_suite = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue