3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #define THIS_FILE "test.c"
24 #define DO_TEST(test) do { \
25 PJ_LOG(3, (THIS_FILE, "Running %s...", #test)); \
27 PJ_LOG(3, (THIS_FILE, \
29 (rc ? "..ERROR" : "..success"), rc)); \
30 if (rc!=0) goto on_return; \
37 void app_perror(pj_status_t status, const char *msg)
39 char errbuf[PJ_ERR_MSG_SIZE];
41 pjmedia_strerror(status, errbuf, sizeof(errbuf));
43 PJ_LOG(3,(THIS_FILE, "%s: %s", msg, errbuf));
46 /* Force linking PLC stuff if G.711 is disabled. See:
47 * https://trac.pjsip.org/repos/ticket/1337
49 #if PJMEDIA_HAS_G711_CODEC==0
53 return &pjmedia_plc_save;
60 pj_caching_pool caching_pool;
64 pj_caching_pool_init(&caching_pool, &pj_pool_factory_default_policy, 0);
65 pool = pj_pool_create(&caching_pool.factory, "test", 1000, 512, NULL);
67 pj_log_set_decor(PJ_LOG_HAS_NEWLINE);
70 mem = &caching_pool.factory;
72 #if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
73 pjmedia_video_format_mgr_create(pool, 64, 0, NULL);
74 pjmedia_converter_mgr_create(pool, NULL);
75 pjmedia_event_mgr_create(pool, 0, NULL);
76 pjmedia_vid_codec_mgr_create(pool, NULL);
80 DO_TEST(vid_port_test());
84 DO_TEST(vid_dev_test());
87 #if HAS_VID_CODEC_TEST
88 DO_TEST(vid_codec_test());
92 DO_TEST(sdp_neg_test());
94 //DO_TEST(sdp_test (&caching_pool.factory));
95 //DO_TEST(rtp_test(&caching_pool.factory));
96 //DO_TEST(session_test (&caching_pool.factory));
101 DO_TEST(mips_test());
103 #if HAS_CODEC_VECTOR_TEST
104 DO_TEST(codec_test_vectors());
107 PJ_LOG(3,(THIS_FILE," "));
111 PJ_LOG(3,(THIS_FILE,"Test completed with error(s)!"));
113 PJ_LOG(3,(THIS_FILE,"Looks like everything is okay!"));
116 #if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
117 pjmedia_video_format_mgr_destroy(pjmedia_video_format_mgr_instance());
118 pjmedia_converter_mgr_destroy(pjmedia_converter_mgr_instance());
119 pjmedia_event_mgr_destroy(pjmedia_event_mgr_instance());
120 pjmedia_vid_codec_mgr_destroy(pjmedia_vid_codec_mgr_instance());
123 pj_pool_release(pool);
124 pj_caching_pool_destroy(&caching_pool);