int mediastreamer2_tester_set_log_file(const char *filename) {
	if (log_file) {
		fclose(log_file);
	}
	log_file = fopen(filename, "w");
	if (!log_file) {
		ms_error("Cannot open file [%s] for writing logs because [%s]", filename, strerror(errno));
		return -1;
	}
	ms_message("Redirecting traces to file [%s]", filename);
	ortp_set_log_file(log_file);
	return 0;
}
Exemplo n.º 2
0
void rtp_init() {
    sem_init(&rtp_semaphore,0,1);

    ortp_init();
    ortp_scheduler_init();
    ortp_set_log_file (stdout);
    ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR);
    jittcomp=100;
    timestamp_jump_limit = 500;
    adapt=1;

    rtp_connected   = 0;
    rtp_listening   = 0;
    rtp_initialized = 1;
}
int apple_main (int argc, char *argv[]) {
#else
int main (int argc, char *argv[]) {
#endif
	int i;
	int ret;

	mediastreamer2_tester_init();

	for(i = 1; i < argc; ++i) {
		if (strcmp(argv[i], "--verbose") == 0) {
			ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
		} else if (strcmp(argv[i], "--silent") == 0) {
			ortp_set_log_level_mask(ORTP_FATAL);
		} else if (strcmp(argv[i],"--log-file")==0){
			CHECK_ARG("--log-file", ++i, argc);
			log_file=fopen(argv[i],"w");
			if (!log_file) {
				ms_error("Cannot open file [%s] for writing logs because [%s]",argv[i],strerror(errno));
				return -2;
			} else {
				ms_message("Redirecting traces to file [%s]",argv[i]);
				ortp_set_log_file(log_file);
			}
		} else {
			int ret = bc_tester_parse_args(argc, argv, i);
			if (ret>0) {
				i += ret - 1;
				continue;
			} else if (ret<0) {
				bc_tester_helper(argv[0], mediastreamer2_helper);
			}
			return ret;
		}
	}

	ret = bc_tester_start();
	mediastreamer2_tester_uninit();
	return ret;

}
Exemplo n.º 4
0
int main (int argc, char *argv[])
{
	int i;
	int ret;

#ifdef HAVE_GTK
	gtk_init(&argc, &argv);
#if !GLIB_CHECK_VERSION(2,32,0) // backward compatibility with Debian 6 and CentOS 6
	g_thread_init(NULL);
#endif
	gdk_threads_init();
#endif

	liblinphone_tester_init(NULL);

	if (strstr(argv[0], ".libs")) {
		char res_dir[128] = {0};
		// this allows to launch liblinphone_tester from outside of tester directory
		strncpy(res_dir, argv[0], strstr(argv[0], ".libs")-argv[0]);
		bc_tester_set_resource_dir_prefix(res_dir);
		bc_tester_set_writable_dir_prefix(res_dir);
	}

	for(i = 1; i < argc; ++i) {
		if (strcmp(argv[i], "--verbose") == 0) {
			linphone_core_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
		} else if (strcmp(argv[i], "--silent") == 0) {
			linphone_core_set_log_level_mask(ORTP_FATAL);
		} else if (strcmp(argv[i],"--log-file")==0){
			CHECK_ARG("--log-file", ++i, argc);
			log_file=fopen(argv[i],"w");
			if (!log_file) {
				ms_error("Cannot open file [%s] for writing logs because [%s]",argv[i],strerror(errno));
				return -2;
			} else {
				ms_message("Redirecting traces to file [%s]",argv[i]);
				ortp_set_log_file(log_file);
			}
		} else if (strcmp(argv[i],"--domain")==0){
			CHECK_ARG("--domain", ++i, argc);
			test_domain=argv[i];
		} else if (strcmp(argv[i],"--auth-domain")==0){
			CHECK_ARG("--auth-domain", ++i, argc);
			auth_domain=argv[i];
		} else if (strcmp(argv[i],"--config")==0){
			CHECK_ARG("--config", ++i, argc);
			bc_tester_set_resource_dir_prefix(argv[i]);
		}else if (strcmp(argv[i],"--dns-hosts")==0){
			CHECK_ARG("--dns-hosts", ++i, argc);
			userhostsfile=argv[i];
		} else if (strcmp(argv[i],"--keep-recorded-files")==0){
			liblinphone_tester_keep_recorded_files(TRUE);
		} else {
			int bret = bc_tester_parse_args(argc, argv, i);
			if (bret>0) {
				i += bret - 1;
				continue;
			} else if (bret<0) {
				bc_tester_helper(argv[0], liblinphone_helper);
			}
			return bret;
		}
	}

	ret = bc_tester_start();
	liblinphone_tester_uninit();
	return ret;
}