~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.1.0/pjmedia/src/test/test.c

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: test.c 3893 2011-12-01 10:49:07Z ming $ */
 
2
/* 
 
3
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
 
4
 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
 
5
 *
 
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.
 
10
 *
 
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.
 
15
 *
 
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 
 
19
 */
 
20
#include "test.h"
 
21
 
 
22
#define THIS_FILE   "test.c"
 
23
 
 
24
#define DO_TEST(test)   do { \
 
25
                            PJ_LOG(3, (THIS_FILE, "Running %s...", #test));  \
 
26
                            rc = test; \
 
27
                            PJ_LOG(3, (THIS_FILE,  \
 
28
                                       "%s(%d)",  \
 
29
                                       (rc ? "..ERROR" : "..success"), rc)); \
 
30
                            if (rc!=0) goto on_return; \
 
31
                        } while (0)
 
32
 
 
33
 
 
34
pj_pool_factory *mem;
 
35
 
 
36
 
 
37
void app_perror(pj_status_t status, const char *msg)
 
38
{
 
39
    char errbuf[PJ_ERR_MSG_SIZE];
 
40
    
 
41
    pjmedia_strerror(status, errbuf, sizeof(errbuf));
 
42
 
 
43
    PJ_LOG(3,(THIS_FILE, "%s: %s", msg, errbuf));
 
44
}
 
45
 
 
46
/* Force linking PLC stuff if G.711 is disabled. See:
 
47
 *  https://trac.pjsip.org/repos/ticket/1337 
 
48
 */
 
49
#if PJMEDIA_HAS_G711_CODEC==0
 
50
int dummy()
 
51
{
 
52
    // Dummy
 
53
    return (int) &pjmedia_plc_save;
 
54
}
 
55
#endif
 
56
 
 
57
int test_main(void)
 
58
{
 
59
    int rc = 0;
 
60
    pj_caching_pool caching_pool;
 
61
    pj_pool_t *pool;
 
62
 
 
63
    pj_init();
 
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);
 
66
 
 
67
    pj_log_set_decor(PJ_LOG_HAS_NEWLINE);
 
68
    pj_log_set_level(3);
 
69
 
 
70
    mem = &caching_pool.factory;
 
71
 
 
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);
 
77
#endif
 
78
 
 
79
#if HAS_VID_PORT_TEST
 
80
    DO_TEST(vid_port_test());
 
81
#endif
 
82
 
 
83
#if HAS_VID_DEV_TEST
 
84
    DO_TEST(vid_dev_test());
 
85
#endif
 
86
 
 
87
#if HAS_VID_CODEC_TEST
 
88
    DO_TEST(vid_codec_test());
 
89
#endif
 
90
 
 
91
#if HAS_SDP_NEG_TEST
 
92
    DO_TEST(sdp_neg_test());
 
93
#endif
 
94
    //DO_TEST(sdp_test (&caching_pool.factory));
 
95
    //DO_TEST(rtp_test(&caching_pool.factory));
 
96
    //DO_TEST(session_test (&caching_pool.factory));
 
97
#if HAS_JBUF_TEST
 
98
    DO_TEST(jbuf_main());
 
99
#endif
 
100
#if HAS_MIPS_TEST
 
101
    DO_TEST(mips_test());
 
102
#endif
 
103
#if HAS_CODEC_VECTOR_TEST
 
104
    DO_TEST(codec_test_vectors());
 
105
#endif
 
106
 
 
107
    PJ_LOG(3,(THIS_FILE," "));
 
108
 
 
109
on_return:
 
110
    if (rc != 0) {
 
111
        PJ_LOG(3,(THIS_FILE,"Test completed with error(s)!"));
 
112
    } else {
 
113
        PJ_LOG(3,(THIS_FILE,"Looks like everything is okay!"));
 
114
    }
 
115
 
 
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());
 
121
#endif
 
122
 
 
123
    pj_pool_release(pool);
 
124
    pj_caching_pool_destroy(&caching_pool);
 
125
 
 
126
    return rc;
 
127
}