本文整理汇总了C++中ortp_free函数的典型用法代码示例。如果您正苦于以下问题:C++ ortp_free函数的具体用法?C++ ortp_free怎么用?C++ ortp_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ortp_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: payload_type_destroy
/**
* Frees a PayloadType.
**/
void payload_type_destroy(PayloadType *pt)
{
if (pt->mime_type) ortp_free(pt->mime_type);
if (pt->recv_fmtp) ortp_free(pt->recv_fmtp);
if (pt->send_fmtp) ortp_free(pt->send_fmtp);
ortp_free(pt);
}
示例2: __ortp_logv_out
static void __ortp_logv_out(OrtpLogLevel lev, const char *fmt, va_list args){
const char *lname="undef";
char *msg;
struct timeval tp;
struct tm *lt;
#ifndef _WIN32
struct tm tmbuf;
#endif
time_t tt;
ortp_gettimeofday(&tp,NULL);
tt = (time_t)tp.tv_sec;
#ifdef _WIN32
lt = localtime(&tt);
#else
lt = localtime_r(&tt,&tmbuf);
#endif
if (__log_file==NULL) __log_file=stderr;
switch(lev){
case ORTP_DEBUG:
lname="debug";
break;
case ORTP_MESSAGE:
lname="message";
break;
case ORTP_WARNING:
lname="warning";
break;
case ORTP_ERROR:
lname="error";
break;
case ORTP_FATAL:
lname="fatal";
break;
default:
ortp_fatal("Bad level !");
}
msg=ortp_strdup_vprintf(fmt,args);
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
#ifndef _UNICODE
OutputDebugStringA(msg);
OutputDebugStringA("\r\n");
#else
{
int len=strlen(msg);
wchar_t *tmp=(wchar_t*)ortp_malloc0((len+1)*sizeof(wchar_t));
mbstowcs(tmp,msg,len);
OutputDebugStringW(tmp);
OutputDebugStringW(L"\r\n");
ortp_free(tmp);
}
#endif
#endif
fprintf(__log_file,"%i-%.2i-%.2i %.2i:%.2i:%.2i:%.3i ortp-%s-%s" ENDLINE
,1900+lt->tm_year,1+lt->tm_mon,lt->tm_mday,lt->tm_hour,lt->tm_min,lt->tm_sec
,(int)(tp.tv_usec/1000), lname,msg);
fflush(__log_file);
ortp_free(msg);
}
示例3: _lp_config_destroy
static void _lp_config_destroy(LpConfig *lpconfig){
if (lpconfig->filename!=NULL) ortp_free(lpconfig->filename);
if (lpconfig->tmpfilename) ortp_free(lpconfig->tmpfilename);
ms_list_for_each(lpconfig->sections,(void (*)(void*))lp_section_destroy);
ms_list_free(lpconfig->sections);
free(lpconfig);
}
示例4: _ortp_logv_flush
void _ortp_logv_flush(int dummy, ...) {
OList *elem;
OList *msglist;
va_list empty_va_list;
va_start(empty_va_list, dummy);
ortp_mutex_lock(&__log_stored_messages_mutex);
msglist = __log_stored_messages_list;
__log_stored_messages_list = NULL;
ortp_mutex_unlock(&__log_stored_messages_mutex);
for (elem = msglist; elem != NULL; elem = o_list_next(elem)) {
ortp_stored_log_t *l = (ortp_stored_log_t *)elem->data;
#ifdef WIN32
ortp_logv_out(l->level, l->msg, empty_va_list);
#else
va_list cap;
va_copy(cap, empty_va_list);
ortp_logv_out(l->level, l->msg, cap);
va_end(cap);
#endif
ortp_free(l->msg);
ortp_free(l);
}
o_list_free(msglist);
va_end(empty_va_list);
}
示例5: ortp_init_srtp_policy
static bool_t ortp_init_srtp_policy(srtp_t srtp, srtp_policy_t* policy, enum ortp_srtp_crypto_suite_t suite, ssrc_t ssrc, const char* b64_key)
{
uint8_t* key;
int key_size;
err_status_t err;
unsigned b64_key_length = strlen(b64_key);
switch (suite) {
case AES_128_SHA1_32:
crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy->rtp);
// srtp doc says: not adapted to rtcp...
crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy->rtcp);
break;
case AES_128_NO_AUTH:
crypto_policy_set_aes_cm_128_null_auth(&policy->rtp);
// srtp doc says: not adapted to rtcp...
crypto_policy_set_aes_cm_128_null_auth(&policy->rtcp);
break;
case NO_CIPHER_SHA1_80:
crypto_policy_set_null_cipher_hmac_sha1_80(&policy->rtp);
crypto_policy_set_null_cipher_hmac_sha1_80(&policy->rtcp);
break;
case AES_128_SHA1_80: /*default mode*/
default:
crypto_policy_set_rtp_default(&policy->rtp);
crypto_policy_set_rtcp_default(&policy->rtcp);
}
//b64_decode(char const *src, size_t srcLen, void *dest, size_t destSize)
key_size = b64_decode(b64_key, b64_key_length, 0, 0);
if (key_size != policy->rtp.cipher_key_len) {
ortp_error("Key size (%d) doesn't match the selected srtp profile (required %d)",
key_size,
policy->rtp.cipher_key_len);
return FALSE;
}
key = (uint8_t*) ortp_malloc0(key_size+2); /*srtp uses padding*/
if (b64_decode(b64_key, b64_key_length, key, key_size) != key_size) {
ortp_error("Error decoding key");
ortp_free(key);
return FALSE;
}
policy->ssrc = ssrc;
policy->key = key;
policy->next = NULL;
err = ortp_srtp_add_stream(srtp, policy);
if (err != err_status_ok) {
ortp_error("Failed to add incoming stream to srtp session (%d)", err);
ortp_free(key);
return FALSE;
}
ortp_free(key);
return TRUE;
}
示例6: o_list_free
OList * o_list_free(OList *list){
OList *elem = list;
OList *tmp;
return_val_if_fail(list, list);
while(elem->next!=NULL) {
tmp = elem;
elem = elem->next;
ortp_free(tmp);
}
ortp_free(elem);
return NULL;
}
示例7: payload_type_set_send_fmtp
/**
* Sets a send parameters (fmtp) for the PayloadType.
* This method is provided for applications using RTP with SDP, but
* actually the ftmp information is not used for RTP processing.
**/
void payload_type_set_send_fmtp(PayloadType *pt, const char *fmtp){
if (canWrite(pt)){
if (pt->send_fmtp!=NULL) ortp_free(pt->send_fmtp);
if (fmtp!=NULL) pt->send_fmtp=ortp_strdup(fmtp);
else pt->send_fmtp=NULL;
}
}
示例8: lp_section_destroy
void lp_section_destroy(LpSection *sec){
ortp_free(sec->name);
ms_list_for_each(sec->items,lp_item_destroy);
ms_list_for_each(sec->params,lp_section_param_destroy);
ms_list_free(sec->items);
free(sec);
}
示例9: __ortp_logv_out
static void __ortp_logv_out(OrtpLogLevel lev, const char *fmt, va_list args){
const char *lname="undef";
char *msg;
if (__log_file==NULL) __log_file=stderr;
switch(lev){
case ORTP_DEBUG:
lname="debug";
break;
case ORTP_MESSAGE:
lname="message";
break;
case ORTP_WARNING:
lname="warning";
break;
case ORTP_ERROR:
lname="error";
break;
case ORTP_FATAL:
lname="fatal";
break;
default:
ortp_fatal("Bad level !");
}
msg=ortp_strdup_vprintf(fmt,args);
#ifdef _MSC_VER
OutputDebugString(msg);
OutputDebugString("\r\n");
#else
fprintf(__log_file,"ortp-%s-%s" ENDLINE,lname,msg);
fflush(__log_file);
#endif
ortp_free(msg);
}
示例10: rtp_profile_destroy
void rtp_profile_destroy(RtpProfile *prof)
{
int i;
PayloadType *payload;
if (prof->name) {
ortp_free(prof->name);
prof->name = NULL;
}
for (i=0; i<RTP_PROFILE_MAX_PAYLOADS; i++)
{
payload=rtp_profile_get_payload(prof,i);
if (payload!=NULL && (payload->flags & PAYLOAD_TYPE_ALLOCATED))
payload_type_destroy(payload);
}
ortp_free(prof);
}
示例11: rtp_scheduler_destroy
void rtp_scheduler_destroy(RtpScheduler *sched)
{
if (sched->thread_running) rtp_scheduler_stop(sched);
ortp_mutex_destroy(&sched->lock);
//g_mutex_free(sched->unblock_select_mutex);
ortp_cond_destroy(&sched->unblock_select_cond);
ortp_free(sched);
}
示例12: ortp_free
OList *o_list_remove_link(OList *list, OList *elem){
OList *ret;
if (elem==list){
ret=elem->next;
elem->prev=NULL;
elem->next=NULL;
if (ret!=NULL) ret->prev=NULL;
ortp_free(elem);
return ret;
}
elem->prev->next=elem->next;
if (elem->next!=NULL) elem->next->prev=elem->prev;
elem->next=NULL;
elem->prev=NULL;
ortp_free(elem);
return list;
}
示例13: ortp_strcat_vprintf
char * ortp_strcat_vprintf(char* dst, const char *fmt, va_list ap){
char *ret;
unsigned long dstlen, retlen;
ret=ortp_strdup_vprintf(fmt, ap);
dstlen = strlen(dst);
retlen = strlen(ret);
if ((dst = ortp_realloc(dst, dstlen+retlen+1)) != NULL){
strncat(dst,ret,retlen);
dst[dstlen+retlen] = '\0';
ortp_free(ret);
return dst;
} else {
ortp_free(ret);
return NULL;
}
}
示例14: ortp_free
RtpEndpoint *rtp_endpoint_new(struct sockaddr *addr, socklen_t addrlen){
RtpEndpoint *ep=ortp_new(RtpEndpoint,1);
if (sizeof(ep->addr)<addrlen){
ortp_free(ep);
ortp_fatal("Bad socklen_t size !");
return NULL;
}
memcpy(&ep->addr,addr,addrlen);
ep->addrlen=addrlen;
return ep;
}
示例15: payload_type_append_recv_fmtp
void payload_type_append_recv_fmtp(PayloadType *pt, const char *fmtp){
if (canWrite(pt)){
if (pt->recv_fmtp==NULL)
pt->recv_fmtp=ortp_strdup(fmtp);
else{
char *tmp=ortp_strdup_printf("%s;%s",pt->recv_fmtp,fmtp);
ortp_free(pt->recv_fmtp);
pt->recv_fmtp=tmp;
}
}
}