本文整理汇总了C++中pj_caching_pool_init函数的典型用法代码示例。如果您正苦于以下问题:C++ pj_caching_pool_init函数的具体用法?C++ pj_caching_pool_init怎么用?C++ pj_caching_pool_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pj_caching_pool_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main() {
pj_caching_pool cp;
pj_pool_t *pool;
pjmedia_endpt *ep;
pjmedia_conf *conf;
pjmedia_port *fp, *mp;
pjmedia_snd_port *sp;
pjmedia_snd_port *mic;
unsigned slot;
pj_init();
pj_srand(12345);
pj_caching_pool_init(&cp, NULL, 1024);
pool = pj_pool_create(&cp.factory, "pool1", 1024, 1024, NULL);
pjmedia_endpt_create(&cp.factory, NULL, 1, &ep);
pjmedia_conf_create(pool, 3, 8000, 1,
8000 * 1 * 20 / 1000, // Sample per frame = # of samples in 20 ms
16, PJMEDIA_CONF_NO_DEVICE, &conf);
mp = pjmedia_conf_get_master_port(conf);
CHECK(__FILE__, pjmedia_snd_port_create_player(pool, 1, 8000, 1, 160, 16, 0, &sp));
printf("sp=%p - mp=%p\n", sp, mp);
pjmedia_snd_port_connect(sp, mp);
pjmedia_snd_port_create_rec(pool, 0, 8000, 1, 160, 16, 0, &mic);
pjmedia_wav_player_port_create(pool, "NHP-mono-pcm-s16le.wav", 0, 0, 0, &fp);
//pjmedia_wav_writer_port_create(pool, "vnt.wav", 8000, 1, 160, 16, 0, 0, &fp);
fp = pjmedia_snd_port_get_port(mic);
pjmedia_conf_add_port(conf, pool, fp, NULL, &slot);
pjmedia_conf_connect_port(conf, slot, 0, 0);
while (1) sleep(2);
}
开发者ID:mocidis,项目名称:media-endpoint,代码行数:34,代码来源:confbridge.c
示例2: SetUpTestCase
static void SetUpTestCase()
{
pj_init();
pj_caching_pool_init(&caching_pool, &pj_pool_factory_default_policy, 0);
pjsip_endpt_create(&caching_pool.factory, NULL, &endpt);
pool = pj_pool_create(&caching_pool.factory, "contact-filtering-test", 4000, 4000, NULL);
};
开发者ID:gfraysse,项目名称:sprout,代码行数:7,代码来源:uriclassifier_test.cpp
示例3: main
/*
* main()
*/
int main(int argc, char *argv[])
{
pj_caching_pool cp;
pjmedia_endpt *med_ept;
pjsip_endpoint *sip_ept;
char errmsg[PJ_ERR_MSG_SIZE];
pj_status_t code;
if (argc != 2) {
puts("Usage: strerror ERRNUM");
return 1;
}
pj_log_set_level(3);
pj_init();
pj_caching_pool_init(&cp, NULL, 0);
pjlib_util_init();
pjnath_init();
pjmedia_endpt_create(&cp.factory, NULL, 0, &med_ept);
pjsip_endpt_create(&cp.factory, "localhost", &sip_ept);
pjsip_evsub_init_module(sip_ept);
code = atoi(argv[1]);
pj_strerror(code, errmsg, sizeof(errmsg));
printf("Status %d: %s\n", code, errmsg);
pj_shutdown();
return 0;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:34,代码来源:strerror.c
示例4: publish_sess_
SIPPresence::SIPPresence(SIPAccount *acc)
: publish_sess_()
, status_data_()
, enabled_(false)
, publish_supported_(false)
, subscribe_supported_(false)
, status_(false)
, note_(" ")
, acc_(acc)
, sub_server_list_() //IP2IP context
, sub_client_list_()
, mutex_()
, mutex_nesting_level_()
, mutex_owner_()
, cp_()
, pool_()
{
/* init pool */
pj_caching_pool_init(&cp_, &pj_pool_factory_default_policy, 0);
pool_ = pj_pool_create(&cp_.factory, "pres", 1000, 1000, NULL);
if (!pool_)
throw std::runtime_error("Could not allocate pool for presence");
/* Create mutex */
if (pj_mutex_create_recursive(pool_, "pres", &mutex_) != PJ_SUCCESS) {
pj_pool_release(pool_);
pj_caching_pool_destroy(&cp_);
throw std::runtime_error("Unable to create mutex");
}
/* init default status */
updateStatus(false, " ");
}
开发者ID:ThereIsNoYeti,项目名称:sflphone,代码行数:33,代码来源:sippresence.cpp
示例5: init_stack
static pj_status_t init_stack()
{
pj_sockaddr addr;
pjsip_inv_callback inv_cb;
pj_status_t status;
pj_log_set_level(5);
status = pj_init();
CHECK_STATUS();
pj_log_set_level(3);
status = pjlib_util_init();
CHECK_STATUS();
pj_caching_pool_init(&app.cp, NULL, 0);
app.pool = pj_pool_create( &app.cp.factory, "sipecho", 512, 512, 0);
status = pjsip_endpt_create(&app.cp.factory, NULL, &app.sip_endpt);
CHECK_STATUS();
pj_log_set_level(4);
pj_sockaddr_init(AF, &addr, NULL, (pj_uint16_t)SIP_PORT);
if (AF == pj_AF_INET()) {
status = pjsip_udp_transport_start( app.sip_endpt, &addr.ipv4, NULL,
1, NULL);
} else if (AF == pj_AF_INET6()) {
status = pjsip_udp_transport_start6(app.sip_endpt, &addr.ipv6, NULL,
1, NULL);
} else {
status = PJ_EAFNOTSUP;
}
pj_log_set_level(3);
CHECK_STATUS();
status = pjsip_tsx_layer_init_module(app.sip_endpt) ||
pjsip_ua_init_module( app.sip_endpt, NULL );
CHECK_STATUS();
pj_bzero(&inv_cb, sizeof(inv_cb));
inv_cb.on_state_changed = &call_on_state_changed;
inv_cb.on_new_session = &call_on_forked;
inv_cb.on_media_update = &call_on_media_update;
inv_cb.on_rx_offer = &call_on_rx_offer;
status = pjsip_inv_usage_init(app.sip_endpt, &inv_cb) ||
pjsip_100rel_init_module(app.sip_endpt) ||
pjsip_endpt_register_module( app.sip_endpt, &mod_sipecho) ||
pjsip_endpt_register_module( app.sip_endpt, &msg_logger) ||
//pjmedia_endpt_create(&app.cp.factory,
// pjsip_endpt_get_ioqueue(app.sip_endpt),
// 0, &app.med_endpt) ||
pj_thread_create(app.pool, "sipecho", &worker_proc, NULL, 0, 0,
&app.worker_thread);
CHECK_STATUS();
return PJ_SUCCESS;
}
开发者ID:xhook,项目名称:asterisk-v11,代码行数:60,代码来源:sipecho.c
示例6: create_app
/*
* Create app
*/
static pj_status_t create_app(void)
{
pj_status_t status;
status = pj_init();
if (status != PJ_SUCCESS) {
app_perror(THIS_FILE, "Error initializing pjlib", status);
return status;
}
/* init PJLIB-UTIL: */
status = pjlib_util_init();
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
/* Must create a pool factory before we can allocate any memory. */
pj_caching_pool_init(&app.cp, &pj_pool_factory_default_policy,
CACHING_POOL_SIZE);
/* Create application pool for misc. */
app.pool = pj_pool_create(&app.cp.factory, "app", 1000, 1000, NULL);
/* Create the endpoint: */
status = pjsip_endpt_create(&app.cp.factory, pj_gethostname()->ptr,
&app.sip_endpt);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
return status;
}
开发者ID:ClearwaterCore,项目名称:pjsip-upstream,代码行数:32,代码来源:pjsip-perf.c
示例7: test_main
int test_main(void)
{
int rc = 0;
pj_caching_pool caching_pool;
pj_init();
pj_caching_pool_init(&caching_pool, &pj_pool_factory_default_policy, 0);
pj_log_set_decor(PJ_LOG_HAS_NEWLINE);
pj_log_set_level(3);
mem = &caching_pool.factory;
DO_TEST(sdp_neg_test());
//DO_TEST(sdp_test (&caching_pool.factory));
//DO_TEST(rtp_test(&caching_pool.factory));
//DO_TEST(session_test (&caching_pool.factory));
DO_TEST(jbuf_main());
DO_TEST(mips_test());
DO_TEST(codec_test_vectors());
PJ_LOG(3,(THIS_FILE," "));
on_return:
if (rc != 0) {
PJ_LOG(3,(THIS_FILE,"Test completed with error(s)!"));
} else {
PJ_LOG(3,(THIS_FILE,"Looks like everything is okay!"));
}
pj_caching_pool_destroy(&caching_pool);
return rc;
}
开发者ID:Jopie64,项目名称:pjsip,代码行数:34,代码来源:test.c
示例8: main
/*
* main()
*/
int main(int argc, char *argv[])
{
pj_caching_pool cp;
pj_status_t status;
if (argc < 2 || argc > 3) {
puts("Usage: httpdemo URL [output-filename]");
return 1;
}
pj_log_set_level(5);
pj_init();
pj_caching_pool_init(&cp, NULL, 0);
mem = &cp.factory;
pjlib_util_init();
if (argc > 2)
f = fopen(argv[2], "wb");
else
f = stdout;
status = getURL(argv[1]);
if (status != PJ_SUCCESS) {
PJ_PERROR(1, (THIS_FILE, status, "Error"));
}
if (f != stdout)
fclose(f);
pj_caching_pool_destroy(&cp);
pj_shutdown();
return 0;
}
开发者ID:avble,项目名称:natClientEx,代码行数:37,代码来源:httpdemo.c
示例9: main
int main(int argc, char *argv[])
{
ics_stream_t stream_data;
char tmp[10];
pj_status_t status;
pj_caching_pool cp;
pj_pool_t *pool;
status = pj_init();
pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
pool = pj_pool_create(&cp.factory, "app", 4000, 4000, NULL);
ics_stream_init(&stream_data, &cp, pool);
ics_stream_create(&stream_data, 4321, "127.0.0.1:1234", "sink");
ics_stream_connect_with_snd_sink(&stream_data);
ics_stream_start(&stream_data);
for (;;) {
if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
puts("EOF while reading stdin, will quit now..");
break;
}
if (tmp[0] == 'q')
break;
}
//Destroy and clean`
ics_stream_clean(&stream_data);
return 0;
}
开发者ID:buidanhquy,项目名称:pjmedia,代码行数:30,代码来源:stream_playback.c
示例10: init
static pj_status_t init()
{
pjmedia_codec_mgr *cm;
pjmedia_codec_info id;
int i;
pj_caching_pool_init(&caching_pool, &pj_pool_factory_default_policy, 0);
pf = &caching_pool.factory;
if (pj_snd_init(&caching_pool.factory))
return -1;
PJ_LOG(3,(THIS_FILE, "Dumping audio devices:"));
for (i=0; i<pj_snd_get_dev_count(); ++i) {
const pj_snd_dev_info *info;
info = pj_snd_get_dev_info(i);
PJ_LOG(3,(THIS_FILE, " %d: %s\t(%d in, %d out",
i, info->name,
info->input_count, info->output_count));
}
mm = pj_med_mgr_create (&caching_pool.factory);
cm = pj_med_mgr_get_codec_mgr (mm);
id.type = PJMEDIA_TYPE_AUDIO;
id.pt = 0;
id.encoding_name = pj_str("PCMU");
id.sample_rate = 8000;
codec = pjmedia_codec_mgr_alloc_codec (cm, &id);
codec->op->default_attr(codec, &cattr);
codec->op->open(codec, &cattr);
return 0;
}
开发者ID:carlosdelfino,项目名称:WorkshopTelefoniaAutomacao,代码行数:34,代码来源:audio_tool.c
示例11: pj_caching_pool_init
void SDPTest::setUp()
{
pj_caching_pool_init (&_poolCache, &pj_pool_factory_default_policy, 0);
_testPool = pj_pool_create (&_poolCache.factory, "sdptest", 4000, 4000, NULL);
_session = new Sdp(_testPool);
}
开发者ID:max3903,项目名称:SFLphone,代码行数:8,代码来源:sdptest.cpp
示例12: main
int main(int argc, char *argv[])
{
pj_caching_pool cp;
pjmedia_endpt *med_endpt;
pj_status_t status;
/* Init pjlib */
status = pj_init();
PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1);
/* Must create a pool factory before we can allocate any memory. */
pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
/*
* Initialize media endpoint.
* This will implicitly initialize PJMEDIA too.
*/
status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
if (argc == 1) {
enum_devices();
return 0;
} else if (argc == 6) {
int dev_id;
pjmedia_dir dir = PJMEDIA_DIR_NONE;
int nchannel;
int bits;
dev_id = atoi(argv[1]);
if (strcmp(argv[2], "rec")==0)
dir = PJMEDIA_DIR_CAPTURE;
else if (strcmp(argv[2], "play")==0)
dir = PJMEDIA_DIR_PLAYBACK;
else if (strcmp(argv[2], "both")==0)
dir = PJMEDIA_DIR_CAPTURE_PLAYBACK;
clock_rate = atoi(argv[3]);
nchannel = atoi(argv[4]);
bits = atoi(argv[5]);
return open_device(dev_id, dir, nchannel, bits);
} else {
puts("Error: invalid arguments");
puts(desc);
return 1;
}
/* Shutdown PJLIB */
pj_shutdown();
return 0;
}
开发者ID:tibastral,项目名称:symphonie,代码行数:57,代码来源:sndinfo.c
示例13: test_inner
static int test_inner(void)
{
pj_caching_pool caching_pool;
int rc = 0;
mem = &caching_pool.factory;
#if 1
pj_log_set_level(3);
pj_log_set_decor(param_log_decor);
PJ_UNUSED_ARG(test_log_func);
#elif 1
log_file = fopen("pjnath-test.log", "wt");
pj_log_set_level(5);
orig_log_func = pj_log_get_log_func();
pj_log_set_log_func(&test_log_func);
#endif
rc = pj_init();
if (rc != 0) {
app_perror("pj_init() error!!", rc);
return rc;
}
pj_dump_config();
pj_caching_pool_init( &caching_pool, &pj_pool_factory_default_policy, 0 );
pjlib_util_init();
pjnath_init();
#if INCLUDE_STUN_TEST
DO_TEST(stun_test());
DO_TEST(sess_auth_test());
#endif
#if INCLUDE_ICE_TEST
DO_TEST(ice_test());
#endif
#if INCLUDE_STUN_SOCK_TEST
DO_TEST(stun_sock_test());
#endif
#if INCLUDE_TURN_SOCK_TEST
DO_TEST(turn_sock_test());
#endif
#if INCLUDE_CONCUR_TEST
DO_TEST(concur_test());
#endif
on_return:
if (log_file)
fclose(log_file);
return rc;
}
开发者ID:Archipov,项目名称:android-client,代码行数:56,代码来源:test.c
示例14: main
int main(int argc, char *argv[])
{
pj_caching_pool cp;
pj_time_val t0, t1;
pj_status_t status;
if (argc != 4) {
puts(desc);
return 1;
}
CHECK( pj_init() );
pj_caching_pool_init(&cp, NULL, 0);
CHECK( pjmedia_endpt_create(&cp.factory, NULL, 1, &mept) );
/* Register all codecs */
#if PJMEDIA_HAS_G711_CODEC
CHECK( pjmedia_codec_g711_init(mept) );
#endif
#if PJMEDIA_HAS_GSM_CODEC
CHECK( pjmedia_codec_gsm_init(mept) );
#endif
#if PJMEDIA_HAS_ILBC_CODEC
CHECK( pjmedia_codec_ilbc_init(mept, 30) );
#endif
#if PJMEDIA_HAS_SPEEX_CODEC
CHECK( pjmedia_codec_speex_init(mept, 0, 5, 5) );
#endif
#if PJMEDIA_HAS_G722_CODEC
CHECK( pjmedia_codec_g722_init(mept) );
#endif
pj_gettimeofday(&t0);
status = enc_dec_test(argv[1], argv[2], argv[3]);
pj_gettimeofday(&t1);
PJ_TIME_VAL_SUB(t1, t0);
pjmedia_endpt_destroy(mept);
pj_caching_pool_destroy(&cp);
pj_shutdown();
if (status == PJ_SUCCESS) {
puts("");
puts("Success");
printf("Duration: %ds.%03d\n", file_msec_duration/1000,
file_msec_duration%1000);
printf("Time: %lds.%03ld\n", t1.sec, t1.msec);
}
return 0;
}
开发者ID:deveck,项目名称:Deveck.TAM,代码行数:53,代码来源:encdec.c
示例15: main
int main() {
pj_caching_pool cp;
pj_caching_pool_init(&cp, NULL, 4000);
CHECK(__FILE__, pj_init());
pjmedia_endpt *endpoint;
pjmedia_endpt_create(&cp.factory, NULL, 1, &endpoint);
//pjmedia_codec_register_audio_codecs(endpoint, NULL);
pjmedia_codec_g711_init(endpoint);
list_codecs(endpoint);
pjmedia_codec_g711_deinit();
list_codecs(endpoint);
return 0;
}
开发者ID:mocidis,项目名称:media-endpoint,代码行数:13,代码来源:test-codecs.c
示例16: main
int main() {
status = pj_init();
pj_caching_pool_init(&cp, NULL, 1024);
pool = pj_pool_create(&cp.factory, "pool", 6400, 6400, NULL);
app_logging_init();
PJ_LOG(3, (__FILE__, "zzzzzz %d", 5));
PJ_LOG(4, (__FILE__, "mmmmmm"));
app_logging_shutdown();
return 0;
}
开发者ID:buidanhquy,项目名称:test,代码行数:14,代码来源:g_file.c
示例17: init_stack
static pj_status_t init_stack(void)
{
pj_status_t status;
/* Must init PJLIB first: */
status = pj_init();
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
/* Then init PJLIB-UTIL: */
status = pjlib_util_init();
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
/* Must create a pool factory before we can allocate any memory. */
pj_caching_pool_init(&global.cp, &pj_pool_factory_default_policy, 0);
/* Create the endpoint: */
status = pjsip_endpt_create(&global.cp.factory, NULL, &global.endpt);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
/* Init transaction layer for stateful proxy only */
#if STATEFUL
status = pjsip_tsx_layer_init_module(global.endpt);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
#endif
/* Create listening transport */
{
pj_sockaddr_in addr;
addr.sin_family = pj_AF_INET();
addr.sin_addr.s_addr = 0;
addr.sin_port = pj_htons((pj_uint16_t)global.port);
status = pjsip_udp_transport_start( global.endpt, &addr,
NULL, 1, NULL);
if (status != PJ_SUCCESS)
return status;
}
/* Create pool for the application */
global.pool = pj_pool_create(&global.cp.factory, "proxyapp",
4000, 4000, NULL);
/* Register the logger module */
pjsip_endpt_register_module(global.endpt, &mod_msg_logger);
return PJ_SUCCESS;
}
开发者ID:tasosbull,项目名称:yewtic,代码行数:50,代码来源:stateful_proxy.c
示例18: test_inner
static int test_inner(void)
{
pj_caching_pool caching_pool;
int rc = 0;
mem = &caching_pool.factory;
pj_log_set_level(3);
pj_log_set_decor(param_log_decor);
rc = pj_init();
if (rc != 0) {
app_perror("pj_init() error!!", rc);
return rc;
}
rc = pjlib_util_init();
pj_assert(rc == 0);
pj_dump_config();
pj_caching_pool_init( &caching_pool, &pj_pool_factory_default_policy, 0 );
#if INCLUDE_XML_TEST
DO_TEST(xml_test());
#endif
#if INCLUDE_JSON_TEST
DO_TEST(json_test());
#endif
#if INCLUDE_ENCRYPTION_TEST
DO_TEST(encryption_test());
DO_TEST(encryption_benchmark());
#endif
#if INCLUDE_STUN_TEST
DO_TEST(stun_test());
#endif
#if INCLUDE_RESOLVER_TEST
DO_TEST(resolver_test());
#endif
#if INCLUDE_HTTP_CLIENT_TEST
DO_TEST(http_client_test());
#endif
on_return:
return rc;
}
开发者ID:avble,项目名称:natClientEx,代码行数:50,代码来源:test.c
示例19: main
int main()
{
pj_turn_srv *srv;
pj_turn_listener *listener;
pj_status_t status;
status = pj_init();
if (status != PJ_SUCCESS)
return err("pj_init() error", status);
pjlib_util_init();
pjnath_init();
pj_caching_pool_init(&g_cp, NULL, 0);
pj_turn_auth_init(REALM);
status = pj_turn_srv_create(&g_cp.factory, &srv);
if (status != PJ_SUCCESS)
return err("Error creating server", status);
status = pj_turn_listener_create_udp(srv, pj_AF_INET(), NULL,
TURN_PORT, 1, 0, &listener);
if (status != PJ_SUCCESS)
return err("Error creating UDP listener", status);
#if PJ_HAS_TCP
status = pj_turn_listener_create_tcp(srv, pj_AF_INET(), NULL,
TURN_PORT, 1, 0, &listener);
if (status != PJ_SUCCESS)
return err("Error creating listener", status);
#endif
status = pj_turn_srv_add_listener(srv, listener);
if (status != PJ_SUCCESS)
return err("Error adding listener", status);
puts("Server is running");
pj_log_set_level(LOG_LEVEL);
console_main(srv);
pj_turn_srv_destroy(srv);
pj_caching_pool_destroy(&g_cp);
pj_shutdown();
return 0;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:49,代码来源:main.c
示例20: main
int main()
{
pj_caching_pool cp;
pj_status_t status;
// Must init PJLIB before anything else
status = pj_init();
if (status != PJ_SUCCESS) {
my_perror("Error initializing PJLIB", status);
return 1;
}
// Create the pool factory, in this case, a caching pool,
// using default pool policy.
pj_caching_pool_init(&cp, NULL, 1024*1024 );
pj_pool_t *pool = pj_pool_create(&cp.factory, "pool1", 4000, 4000, NULL);
pj_str_t test1_str = test1();
PRINT_PSTR_DETAILS(&test1_str);
pj_str_t test2_str = test2();
PRINT_PSTR_DETAILS(&test2_str);
pj_str_t test3_str = test3();
PRINT_PSTR_DETAILS(&test3_str);
PRINT_PSTR_DETAILS(test4());
PRINT_PSTR_DETAILS(test5());
PRINT_PSTR_DETAILS(test6(pool));
pj_str_t test7_str = test7();
PRINT_PSTR_DETAILS(&test7_str);
pj_str_t test8_str = test8(pool);
PRINT_PSTR_DETAILS(&test8_str);
pj_pool_release(pool);
// Done with demos, destroy caching pool before exiting app.
pj_caching_pool_destroy(&cp);
return 0;
}
开发者ID:chaitanyagupta,项目名称:pjsip-walkthrough,代码行数:43,代码来源:pj_str.c
注:本文中的pj_caching_pool_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论