mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
Version 0.1.8 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -363,17 +363,17 @@ static char *aopen_identify(struct ast_modem_pvt *p)
|
|||||||
|
|
||||||
static void aopen_incusecnt()
|
static void aopen_incusecnt()
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&usecnt_lock);
|
ast_pthread_mutex_lock(&usecnt_lock);
|
||||||
usecnt++;
|
usecnt++;
|
||||||
pthread_mutex_unlock(&usecnt_lock);
|
ast_pthread_mutex_unlock(&usecnt_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aopen_decusecnt()
|
static void aopen_decusecnt()
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&usecnt_lock);
|
ast_pthread_mutex_lock(&usecnt_lock);
|
||||||
usecnt++;
|
usecnt++;
|
||||||
pthread_mutex_unlock(&usecnt_lock);
|
ast_pthread_mutex_unlock(&usecnt_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,9 +457,9 @@ static struct ast_modem_driver aopen_driver =
|
|||||||
int usecount(void)
|
int usecount(void)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
pthread_mutex_lock(&usecnt_lock);
|
ast_pthread_mutex_lock(&usecnt_lock);
|
||||||
res = usecnt;
|
res = usecnt;
|
||||||
pthread_mutex_unlock(&usecnt_lock);
|
ast_pthread_mutex_unlock(&usecnt_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -423,17 +423,17 @@ static char *i4l_identify(struct ast_modem_pvt *p)
|
|||||||
|
|
||||||
static void i4l_incusecnt()
|
static void i4l_incusecnt()
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&usecnt_lock);
|
ast_pthread_mutex_lock(&usecnt_lock);
|
||||||
usecnt++;
|
usecnt++;
|
||||||
pthread_mutex_unlock(&usecnt_lock);
|
ast_pthread_mutex_unlock(&usecnt_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void i4l_decusecnt()
|
static void i4l_decusecnt()
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&usecnt_lock);
|
ast_pthread_mutex_lock(&usecnt_lock);
|
||||||
usecnt++;
|
usecnt++;
|
||||||
pthread_mutex_unlock(&usecnt_lock);
|
ast_pthread_mutex_unlock(&usecnt_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,9 +551,9 @@ static struct ast_modem_driver i4l_driver =
|
|||||||
int usecount(void)
|
int usecount(void)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
pthread_mutex_lock(&usecnt_lock);
|
ast_pthread_mutex_lock(&usecnt_lock);
|
||||||
res = usecnt;
|
res = usecnt;
|
||||||
pthread_mutex_unlock(&usecnt_lock);
|
ast_pthread_mutex_unlock(&usecnt_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include <asterisk/logger.h>
|
#include <asterisk/logger.h>
|
||||||
#include <asterisk/module.h>
|
#include <asterisk/module.h>
|
||||||
#include <asterisk/translate.h>
|
#include <asterisk/translate.h>
|
||||||
|
#include <asterisk/channel.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@@ -498,13 +499,13 @@ int
|
|||||||
unload_module (void)
|
unload_module (void)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
pthread_mutex_lock (&localuser_lock);
|
ast_pthread_mutex_lock (&localuser_lock);
|
||||||
res = ast_unregister_translator (&lintoadpcm);
|
res = ast_unregister_translator (&lintoadpcm);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_unregister_translator (&adpcmtolin);
|
res = ast_unregister_translator (&adpcmtolin);
|
||||||
if (localusecnt)
|
if (localusecnt)
|
||||||
res = -1;
|
res = -1;
|
||||||
pthread_mutex_unlock (&localuser_lock);
|
ast_pthread_mutex_unlock (&localuser_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include <asterisk/translate.h>
|
#include <asterisk/translate.h>
|
||||||
#include <asterisk/module.h>
|
#include <asterisk/module.h>
|
||||||
#include <asterisk/logger.h>
|
#include <asterisk/logger.h>
|
||||||
|
#include <asterisk/channel.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -221,13 +222,13 @@ static struct ast_translator lintogsm =
|
|||||||
int unload_module(void)
|
int unload_module(void)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
pthread_mutex_lock(&localuser_lock);
|
ast_pthread_mutex_lock(&localuser_lock);
|
||||||
res = ast_unregister_translator(&lintogsm);
|
res = ast_unregister_translator(&lintogsm);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_unregister_translator(&gsmtolin);
|
res = ast_unregister_translator(&gsmtolin);
|
||||||
if (localusecnt)
|
if (localusecnt)
|
||||||
res = -1;
|
res = -1;
|
||||||
pthread_mutex_unlock(&localuser_lock);
|
ast_pthread_mutex_unlock(&localuser_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include <asterisk/translate.h>
|
#include <asterisk/translate.h>
|
||||||
#include <asterisk/module.h>
|
#include <asterisk/module.h>
|
||||||
#include <asterisk/logger.h>
|
#include <asterisk/logger.h>
|
||||||
|
#include <asterisk/channel.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -333,13 +334,13 @@ static struct ast_translator lintolpc10 =
|
|||||||
int unload_module(void)
|
int unload_module(void)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
pthread_mutex_lock(&localuser_lock);
|
ast_pthread_mutex_lock(&localuser_lock);
|
||||||
res = ast_unregister_translator(&lintolpc10);
|
res = ast_unregister_translator(&lintolpc10);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_unregister_translator(&lpc10tolin);
|
res = ast_unregister_translator(&lpc10tolin);
|
||||||
if (localusecnt)
|
if (localusecnt)
|
||||||
res = -1;
|
res = -1;
|
||||||
pthread_mutex_unlock(&localuser_lock);
|
ast_pthread_mutex_unlock(&localuser_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ static struct ast_filestream *g723_open(int fd)
|
|||||||
and be sure it's a valid file. */
|
and be sure it's a valid file. */
|
||||||
struct ast_filestream *tmp;
|
struct ast_filestream *tmp;
|
||||||
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
||||||
if (pthread_mutex_lock(&g723_lock)) {
|
if (ast_pthread_mutex_lock(&g723_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -78,7 +78,7 @@ static struct ast_filestream *g723_open(int fd)
|
|||||||
tmp->orig.tv_usec = 0;
|
tmp->orig.tv_usec = 0;
|
||||||
tmp->orig.tv_sec = 0;
|
tmp->orig.tv_sec = 0;
|
||||||
glistcnt++;
|
glistcnt++;
|
||||||
pthread_mutex_unlock(&g723_lock);
|
ast_pthread_mutex_unlock(&g723_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
@@ -91,7 +91,7 @@ static struct ast_filestream *g723_rewrite(int fd, char *comment)
|
|||||||
and be sure it's a valid file. */
|
and be sure it's a valid file. */
|
||||||
struct ast_filestream *tmp;
|
struct ast_filestream *tmp;
|
||||||
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
||||||
if (pthread_mutex_lock(&g723_lock)) {
|
if (ast_pthread_mutex_lock(&g723_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -105,7 +105,7 @@ static struct ast_filestream *g723_rewrite(int fd, char *comment)
|
|||||||
tmp->orig.tv_usec = 0;
|
tmp->orig.tv_usec = 0;
|
||||||
tmp->orig.tv_sec = 0;
|
tmp->orig.tv_sec = 0;
|
||||||
glistcnt++;
|
glistcnt++;
|
||||||
pthread_mutex_unlock(&g723_lock);
|
ast_pthread_mutex_unlock(&g723_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Out of memory\n");
|
ast_log(LOG_WARNING, "Out of memory\n");
|
||||||
@@ -120,7 +120,7 @@ static struct ast_frame *g723_read(struct ast_filestream *s)
|
|||||||
static void g723_close(struct ast_filestream *s)
|
static void g723_close(struct ast_filestream *s)
|
||||||
{
|
{
|
||||||
struct ast_filestream *tmp, *tmpl = NULL;
|
struct ast_filestream *tmp, *tmpl = NULL;
|
||||||
if (pthread_mutex_lock(&g723_lock)) {
|
if (ast_pthread_mutex_lock(&g723_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ static void g723_close(struct ast_filestream *s)
|
|||||||
ast_sched_del(s->owner->sched, s->owner->streamid);
|
ast_sched_del(s->owner->sched, s->owner->streamid);
|
||||||
s->owner->streamid = -1;
|
s->owner->streamid = -1;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g723_lock);
|
ast_pthread_mutex_unlock(&g723_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
|
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
|
||||||
@@ -317,7 +317,7 @@ int load_module()
|
|||||||
int unload_module()
|
int unload_module()
|
||||||
{
|
{
|
||||||
struct ast_filestream *tmp, *tmpl;
|
struct ast_filestream *tmp, *tmpl;
|
||||||
if (pthread_mutex_lock(&g723_lock)) {
|
if (ast_pthread_mutex_lock(&g723_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -329,19 +329,19 @@ int unload_module()
|
|||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
free(tmpl);
|
free(tmpl);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&g723_lock);
|
ast_pthread_mutex_unlock(&g723_lock);
|
||||||
return ast_format_unregister(name);
|
return ast_format_unregister(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int usecount()
|
int usecount()
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
if (pthread_mutex_lock(&g723_lock)) {
|
if (ast_pthread_mutex_lock(&g723_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
ast_log(LOG_WARNING, "Unable to lock g723 list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
res = glistcnt;
|
res = glistcnt;
|
||||||
pthread_mutex_unlock(&g723_lock);
|
ast_pthread_mutex_unlock(&g723_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ static struct ast_filestream *gsm_open(int fd)
|
|||||||
struct ast_filestream *tmp;
|
struct ast_filestream *tmp;
|
||||||
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
||||||
memset(tmp, 0, sizeof(struct ast_filestream));
|
memset(tmp, 0, sizeof(struct ast_filestream));
|
||||||
if (pthread_mutex_lock(&gsm_lock)) {
|
if (ast_pthread_mutex_lock(&gsm_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -81,7 +81,7 @@ static struct ast_filestream *gsm_open(int fd)
|
|||||||
tmp->fr.mallocd = 0;
|
tmp->fr.mallocd = 0;
|
||||||
tmp->lasttimeout = -1;
|
tmp->lasttimeout = -1;
|
||||||
glistcnt++;
|
glistcnt++;
|
||||||
pthread_mutex_unlock(&gsm_lock);
|
ast_pthread_mutex_unlock(&gsm_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
@@ -95,7 +95,7 @@ static struct ast_filestream *gsm_rewrite(int fd, char *comment)
|
|||||||
struct ast_filestream *tmp;
|
struct ast_filestream *tmp;
|
||||||
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
||||||
memset(tmp, 0, sizeof(struct ast_filestream));
|
memset(tmp, 0, sizeof(struct ast_filestream));
|
||||||
if (pthread_mutex_lock(&gsm_lock)) {
|
if (ast_pthread_mutex_lock(&gsm_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -106,7 +106,7 @@ static struct ast_filestream *gsm_rewrite(int fd, char *comment)
|
|||||||
tmp->owner = NULL;
|
tmp->owner = NULL;
|
||||||
tmp->lasttimeout = -1;
|
tmp->lasttimeout = -1;
|
||||||
glistcnt++;
|
glistcnt++;
|
||||||
pthread_mutex_unlock(&gsm_lock);
|
ast_pthread_mutex_unlock(&gsm_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Out of memory\n");
|
ast_log(LOG_WARNING, "Out of memory\n");
|
||||||
@@ -121,7 +121,7 @@ static struct ast_frame *gsm_read(struct ast_filestream *s)
|
|||||||
static void gsm_close(struct ast_filestream *s)
|
static void gsm_close(struct ast_filestream *s)
|
||||||
{
|
{
|
||||||
struct ast_filestream *tmp, *tmpl = NULL;
|
struct ast_filestream *tmp, *tmpl = NULL;
|
||||||
if (pthread_mutex_lock(&gsm_lock)) {
|
if (ast_pthread_mutex_lock(&gsm_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ static void gsm_close(struct ast_filestream *s)
|
|||||||
ast_sched_del(s->owner->sched, s->owner->streamid);
|
ast_sched_del(s->owner->sched, s->owner->streamid);
|
||||||
s->owner->streamid = -1;
|
s->owner->streamid = -1;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&gsm_lock);
|
ast_pthread_mutex_unlock(&gsm_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
|
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
|
||||||
@@ -263,7 +263,7 @@ int load_module()
|
|||||||
int unload_module()
|
int unload_module()
|
||||||
{
|
{
|
||||||
struct ast_filestream *tmp, *tmpl;
|
struct ast_filestream *tmp, *tmpl;
|
||||||
if (pthread_mutex_lock(&gsm_lock)) {
|
if (ast_pthread_mutex_lock(&gsm_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -275,19 +275,19 @@ int unload_module()
|
|||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
free(tmpl);
|
free(tmpl);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&gsm_lock);
|
ast_pthread_mutex_unlock(&gsm_lock);
|
||||||
return ast_format_unregister(name);
|
return ast_format_unregister(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int usecount()
|
int usecount()
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
if (pthread_mutex_lock(&gsm_lock)) {
|
if (ast_pthread_mutex_lock(&gsm_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
ast_log(LOG_WARNING, "Unable to lock gsm list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
res = glistcnt;
|
res = glistcnt;
|
||||||
pthread_mutex_unlock(&gsm_lock);
|
ast_pthread_mutex_unlock(&gsm_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -172,7 +172,7 @@ static struct ast_filestream *vox_open(int fd)
|
|||||||
struct ast_filestream *tmp;
|
struct ast_filestream *tmp;
|
||||||
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
||||||
memset(tmp, 0, sizeof(struct ast_filestream));
|
memset(tmp, 0, sizeof(struct ast_filestream));
|
||||||
if (pthread_mutex_lock(&vox_lock)) {
|
if (ast_pthread_mutex_lock(&vox_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -189,7 +189,7 @@ static struct ast_filestream *vox_open(int fd)
|
|||||||
tmp->fr.mallocd = 0;
|
tmp->fr.mallocd = 0;
|
||||||
tmp->lasttimeout = -1;
|
tmp->lasttimeout = -1;
|
||||||
glistcnt++;
|
glistcnt++;
|
||||||
pthread_mutex_unlock(&vox_lock);
|
ast_pthread_mutex_unlock(&vox_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
@@ -203,7 +203,7 @@ static struct ast_filestream *vox_rewrite(int fd, char *comment)
|
|||||||
struct ast_filestream *tmp;
|
struct ast_filestream *tmp;
|
||||||
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
if ((tmp = malloc(sizeof(struct ast_filestream)))) {
|
||||||
memset(tmp, 0, sizeof(struct ast_filestream));
|
memset(tmp, 0, sizeof(struct ast_filestream));
|
||||||
if (pthread_mutex_lock(&vox_lock)) {
|
if (ast_pthread_mutex_lock(&vox_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -214,7 +214,7 @@ static struct ast_filestream *vox_rewrite(int fd, char *comment)
|
|||||||
tmp->owner = NULL;
|
tmp->owner = NULL;
|
||||||
tmp->lasttimeout = -1;
|
tmp->lasttimeout = -1;
|
||||||
glistcnt++;
|
glistcnt++;
|
||||||
pthread_mutex_unlock(&vox_lock);
|
ast_pthread_mutex_unlock(&vox_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Out of memory\n");
|
ast_log(LOG_WARNING, "Out of memory\n");
|
||||||
@@ -229,7 +229,7 @@ static struct ast_frame *vox_read(struct ast_filestream *s)
|
|||||||
static void vox_close(struct ast_filestream *s)
|
static void vox_close(struct ast_filestream *s)
|
||||||
{
|
{
|
||||||
struct ast_filestream *tmp, *tmpl = NULL;
|
struct ast_filestream *tmp, *tmpl = NULL;
|
||||||
if (pthread_mutex_lock(&vox_lock)) {
|
if (ast_pthread_mutex_lock(&vox_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ static void vox_close(struct ast_filestream *s)
|
|||||||
ast_sched_del(s->owner->sched, s->owner->streamid);
|
ast_sched_del(s->owner->sched, s->owner->streamid);
|
||||||
s->owner->streamid = -1;
|
s->owner->streamid = -1;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&vox_lock);
|
ast_pthread_mutex_unlock(&vox_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
|
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
|
||||||
@@ -382,7 +382,7 @@ int load_module()
|
|||||||
int unload_module()
|
int unload_module()
|
||||||
{
|
{
|
||||||
struct ast_filestream *tmp, *tmpl;
|
struct ast_filestream *tmp, *tmpl;
|
||||||
if (pthread_mutex_lock(&vox_lock)) {
|
if (ast_pthread_mutex_lock(&vox_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -394,19 +394,19 @@ int unload_module()
|
|||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
free(tmpl);
|
free(tmpl);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&vox_lock);
|
ast_pthread_mutex_unlock(&vox_lock);
|
||||||
return ast_format_unregister(name);
|
return ast_format_unregister(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int usecount()
|
int usecount()
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
if (pthread_mutex_lock(&vox_lock)) {
|
if (ast_pthread_mutex_lock(&vox_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
ast_log(LOG_WARNING, "Unable to lock vox list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
res = glistcnt;
|
res = glistcnt;
|
||||||
pthread_mutex_unlock(&vox_lock);
|
ast_pthread_mutex_unlock(&vox_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -327,7 +327,7 @@ static struct ast_filestream *wav_open(int fd)
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (pthread_mutex_lock(&wav_lock)) {
|
if (ast_pthread_mutex_lock(&wav_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -345,7 +345,7 @@ static struct ast_filestream *wav_open(int fd)
|
|||||||
tmp->secondhalf = 0;
|
tmp->secondhalf = 0;
|
||||||
tmp->lasttimeout = -1;
|
tmp->lasttimeout = -1;
|
||||||
glistcnt++;
|
glistcnt++;
|
||||||
pthread_mutex_unlock(&wav_lock);
|
ast_pthread_mutex_unlock(&wav_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
@@ -363,7 +363,7 @@ static struct ast_filestream *wav_rewrite(int fd, char *comment)
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (pthread_mutex_lock(&wav_lock)) {
|
if (ast_pthread_mutex_lock(&wav_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -374,7 +374,7 @@ static struct ast_filestream *wav_rewrite(int fd, char *comment)
|
|||||||
tmp->owner = NULL;
|
tmp->owner = NULL;
|
||||||
tmp->lasttimeout = -1;
|
tmp->lasttimeout = -1;
|
||||||
glistcnt++;
|
glistcnt++;
|
||||||
pthread_mutex_unlock(&wav_lock);
|
ast_pthread_mutex_unlock(&wav_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Out of memory\n");
|
ast_log(LOG_WARNING, "Out of memory\n");
|
||||||
@@ -390,7 +390,7 @@ static void wav_close(struct ast_filestream *s)
|
|||||||
{
|
{
|
||||||
struct ast_filestream *tmp, *tmpl = NULL;
|
struct ast_filestream *tmp, *tmpl = NULL;
|
||||||
char zero = 0;
|
char zero = 0;
|
||||||
if (pthread_mutex_lock(&wav_lock)) {
|
if (ast_pthread_mutex_lock(&wav_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@ static void wav_close(struct ast_filestream *s)
|
|||||||
ast_sched_del(s->owner->sched, s->owner->streamid);
|
ast_sched_del(s->owner->sched, s->owner->streamid);
|
||||||
s->owner->streamid = -1;
|
s->owner->streamid = -1;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&wav_lock);
|
ast_pthread_mutex_unlock(&wav_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
|
ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
|
||||||
@@ -551,7 +551,7 @@ int load_module()
|
|||||||
int unload_module()
|
int unload_module()
|
||||||
{
|
{
|
||||||
struct ast_filestream *tmp, *tmpl;
|
struct ast_filestream *tmp, *tmpl;
|
||||||
if (pthread_mutex_lock(&wav_lock)) {
|
if (ast_pthread_mutex_lock(&wav_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -563,19 +563,19 @@ int unload_module()
|
|||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
free(tmpl);
|
free(tmpl);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&wav_lock);
|
ast_pthread_mutex_unlock(&wav_lock);
|
||||||
return ast_format_unregister(name);
|
return ast_format_unregister(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int usecount()
|
int usecount()
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
if (pthread_mutex_lock(&wav_lock)) {
|
if (ast_pthread_mutex_lock(&wav_lock)) {
|
||||||
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
ast_log(LOG_WARNING, "Unable to lock wav list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
res = glistcnt;
|
res = glistcnt;
|
||||||
pthread_mutex_unlock(&wav_lock);
|
ast_pthread_mutex_unlock(&wav_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
translate.c
16
translate.c
@@ -253,7 +253,7 @@ static int show_translation(int fd, int argc, char *argv[])
|
|||||||
return RESULT_SHOWUSAGE;
|
return RESULT_SHOWUSAGE;
|
||||||
ast_cli(fd, " Translation times between formats (in milliseconds)\n");
|
ast_cli(fd, " Translation times between formats (in milliseconds)\n");
|
||||||
ast_cli(fd, " Destination Format\n");
|
ast_cli(fd, " Destination Format\n");
|
||||||
pthread_mutex_lock(&list_lock);
|
ast_pthread_mutex_lock(&list_lock);
|
||||||
for (x=0;x<SHOW_TRANS; x++) {
|
for (x=0;x<SHOW_TRANS; x++) {
|
||||||
if (x == 1)
|
if (x == 1)
|
||||||
strcpy(line, " Src ");
|
strcpy(line, " Src ");
|
||||||
@@ -270,7 +270,7 @@ static int show_translation(int fd, int argc, char *argv[])
|
|||||||
snprintf(line + strlen(line), sizeof(line) - strlen(line), "\n");
|
snprintf(line + strlen(line), sizeof(line) - strlen(line), "\n");
|
||||||
ast_cli(fd, line);
|
ast_cli(fd, line);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&list_lock);
|
ast_pthread_mutex_unlock(&list_lock);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ int ast_register_translator(struct ast_translator *t)
|
|||||||
calc_cost(t);
|
calc_cost(t);
|
||||||
if (option_verbose > 1)
|
if (option_verbose > 1)
|
||||||
ast_verbose(VERBOSE_PREFIX_2 "Registered translator '%s' from format %d to %d, cost %d\n", t->name, t->srcfmt, t->dstfmt, t->cost);
|
ast_verbose(VERBOSE_PREFIX_2 "Registered translator '%s' from format %d to %d, cost %d\n", t->name, t->srcfmt, t->dstfmt, t->cost);
|
||||||
pthread_mutex_lock(&list_lock);
|
ast_pthread_mutex_lock(&list_lock);
|
||||||
if (!added_cli) {
|
if (!added_cli) {
|
||||||
ast_cli_register(&show_trans);
|
ast_cli_register(&show_trans);
|
||||||
added_cli++;
|
added_cli++;
|
||||||
@@ -303,14 +303,14 @@ int ast_register_translator(struct ast_translator *t)
|
|||||||
t->next = list;
|
t->next = list;
|
||||||
list = t;
|
list = t;
|
||||||
rebuild_matrix();
|
rebuild_matrix();
|
||||||
pthread_mutex_unlock(&list_lock);
|
ast_pthread_mutex_unlock(&list_lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_unregister_translator(struct ast_translator *t)
|
int ast_unregister_translator(struct ast_translator *t)
|
||||||
{
|
{
|
||||||
struct ast_translator *u, *ul = NULL;
|
struct ast_translator *u, *ul = NULL;
|
||||||
pthread_mutex_lock(&list_lock);
|
ast_pthread_mutex_lock(&list_lock);
|
||||||
u = list;
|
u = list;
|
||||||
while(u) {
|
while(u) {
|
||||||
if (u == t) {
|
if (u == t) {
|
||||||
@@ -324,7 +324,7 @@ int ast_unregister_translator(struct ast_translator *t)
|
|||||||
u = u->next;
|
u = u->next;
|
||||||
}
|
}
|
||||||
rebuild_matrix();
|
rebuild_matrix();
|
||||||
pthread_mutex_unlock(&list_lock);
|
ast_pthread_mutex_unlock(&list_lock);
|
||||||
return (u ? 0 : -1);
|
return (u ? 0 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ int ast_translator_best_choice(int *dst, int *srcs)
|
|||||||
int bestdst=0;
|
int bestdst=0;
|
||||||
int cur = 1;
|
int cur = 1;
|
||||||
int besttime=999999999;
|
int besttime=999999999;
|
||||||
pthread_mutex_lock(&list_lock);
|
ast_pthread_mutex_lock(&list_lock);
|
||||||
for (y=0;y<MAX_FORMAT;y++) {
|
for (y=0;y<MAX_FORMAT;y++) {
|
||||||
if ((cur & *dst) && (cur & *srcs)) {
|
if ((cur & *dst) && (cur & *srcs)) {
|
||||||
/* This is a common format to both. Pick it if we don't have one already */
|
/* This is a common format to both. Pick it if we don't have one already */
|
||||||
@@ -363,6 +363,6 @@ int ast_translator_best_choice(int *dst, int *srcs)
|
|||||||
*dst = bestdst;
|
*dst = bestdst;
|
||||||
best = 0;
|
best = 0;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&list_lock);
|
ast_pthread_mutex_unlock(&list_lock);
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user