summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-09-10 21:33:45 +0200
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-09-10 21:33:45 +0200
commit8fa77415960bc6811715e6182bfc2fe4ef434f67 (patch)
treeee85590a978c4b3a929247d53bde8b737a3577b0
parent639c20bbf0085de7b5265c80ab29aba58fc371cb (diff)
use warning() instead of error()
ref https://github.com/alfredh/baresip/issues/295
-rw-r--r--modules/dtmfio/dtmfio.c4
-rw-r--r--modules/mpa/decode.c18
-rw-r--r--modules/mpa/encode.c14
-rw-r--r--modules/mpa/mpa.c10
-rw-r--r--modules/presence/subscriber.c5
5 files changed, 27 insertions, 24 deletions
diff --git a/modules/dtmfio/dtmfio.c b/modules/dtmfio/dtmfio.c
index e159888..8df0a22 100644
--- a/modules/dtmfio/dtmfio.c
+++ b/modules/dtmfio/dtmfio.c
@@ -108,7 +108,7 @@ static int module_init(void)
{
if ( mkfifo( DTMF_OUT, S_IWUSR | S_IRUSR ) ) {
int err = errno;
- error("Creation of the FIFO errored."
+ warning("Creation of the FIFO errored."
" This might cause issues. (%m)\n", err);
return err;
}
@@ -116,7 +116,7 @@ static int module_init(void)
fd = fopen( DTMF_OUT , "w+" );
if ( fd == 0 ){
- error("Opening of the FIFO errored."
+ warning("Opening of the FIFO errored."
" This might cause issues.\n");
}
diff --git a/modules/mpa/decode.c b/modules/mpa/decode.c
index 8a92fbc..4e2a720 100644
--- a/modules/mpa/decode.c
+++ b/modules/mpa/decode.c
@@ -65,7 +65,7 @@ int mpa_decode_update(struct audec_state **adsp, const struct aucodec *ac,
ads->dec = mpg123_new(NULL,&result);
if (!ads->dec) {
- error("MPA dec create: %s\n",
+ warning("MPA dec create: %s\n",
mpg123_plain_strerror(result));
err = ENOMEM;
goto out;
@@ -77,7 +77,7 @@ int mpa_decode_update(struct audec_state **adsp, const struct aucodec *ac,
result = mpg123_param(ads->dec, MPG123_VERBOSE, 0, 0.);
#endif
if (result != MPG123_OK) {
- error("MPA dec param error %s\n",
+ warning("MPA dec param error %s\n",
mpg123_plain_strerror(result));
err = EINVAL;
goto out;
@@ -86,7 +86,7 @@ int mpa_decode_update(struct audec_state **adsp, const struct aucodec *ac,
result = mpg123_format_all(ads->dec);
if (result != MPG123_OK) {
- error("MPA dec format error %s\n",
+ warning("MPA dec format error %s\n",
mpg123_plain_strerror(result));
err = EINVAL;
goto out;
@@ -94,13 +94,12 @@ int mpa_decode_update(struct audec_state **adsp, const struct aucodec *ac,
result = mpg123_open_feed(ads->dec);
if (result != MPG123_OK) {
- error("MPA dec open feed error %s\n",
+ warning("MPA dec open feed error %s\n",
mpg123_plain_strerror(result));
err = EINVAL;
goto out;
}
-
out:
if (err)
mem_deref(ads);
@@ -128,7 +127,7 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
return EINVAL;
if (*(uint32_t*)(void *)buf != 0) {
- error("MPA dec header is not zero %08X, not supported yet\n",
+ warning("MPA dec header is not zero %08X, not supported yet\n",
*(uint32_t*)(void *)buf);
return EPROTO;
}
@@ -157,7 +156,8 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
3, &result);
if (result!=RESAMPLER_ERR_SUCCESS
|| ads->resampler==NULL) {
- error("MPA dec upsampler failed %d\n",result);
+ warning("MPA dec upsampler failed %d\n",
+ result);
return EINVAL;
}
}
@@ -167,7 +167,7 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
else if (result == MPG123_NEED_MORE)
; /* workaround: do nothing */
else if (result != MPG123_OK) {
- error("MPA dec feed error %d %s\n", result,
+ warning("MPA dec feed error %d %s\n", result,
mpg123_plain_strerror(result));
return EPROTO;
}
@@ -181,7 +181,7 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
ads->resampler, ads->intermediate_buffer,
&intermediate_len, sampv, &out_len);
if (result!=RESAMPLER_ERR_SUCCESS) {
- error("MPA dec upsample error: %s %d %d\n",
+ warning("MPA dec upsample error: %s %d %d\n",
strerror(result), out_len, *sampc/2);
return EPROTO;
}
diff --git a/modules/mpa/encode.c b/modules/mpa/encode.c
index ec0b0a2..d13bc0a 100644
--- a/modules/mpa/encode.c
+++ b/modules/mpa/encode.c
@@ -11,6 +11,7 @@
#include <speex/speex_resampler.h>
#include "mpa.h"
+
struct auenc_state {
twolame_options *enc;
int channels, samplerate;
@@ -36,6 +37,7 @@ static void destructor(void *arg)
#endif
}
+
int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
struct auenc_param *param, const char *fmtp)
{
@@ -60,7 +62,7 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
aes->enc = twolame_init();
if (!aes->enc) {
- error("MPA enc create failed\n");
+ warning("MPA enc create failed\n");
mem_deref(aes);
return ENOMEM;
}
@@ -96,14 +98,14 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
result |= twolame_set_out_samplerate(aes->enc, prm.samplerate);
result |= twolame_set_num_channels(aes->enc, 2);
if (result!=0) {
- error("MPA enc set failed\n");
+ warning("MPA enc set failed\n");
err=EINVAL;
goto out;
}
result = twolame_init_params(aes->enc);
if (result!=0) {
- error("MPA enc init params failed\n");
+ warning("MPA enc init params failed\n");
err=EINVAL;
goto out;
}
@@ -114,7 +116,7 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
aes->resampler = speex_resampler_init(2, MPA_IORATE,
prm.samplerate, 3, &result);
if (result!=RESAMPLER_ERR_SUCCESS) {
- error("MPA enc resampler init failed %d\n",result);
+ warning("MPA enc resampler init failed %d\n",result);
err=EINVAL;
goto out;
}
@@ -150,7 +152,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len,
sampv, &in_len, aes->intermediate_buffer,
&intermediate_len);
if (n!=RESAMPLER_ERR_SUCCESS || in_len != sampc/2) {
- error("MPA enc downsample error: %s %d %d\n",
+ warning("MPA enc downsample error: %s %d %d\n",
strerror(n), in_len, sampc/2);
return EPROTO;
}
@@ -172,7 +174,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len,
#endif
}
if (n < 0) {
- error("MPA enc error %s\n", strerror((int)n));
+ warning("MPA enc error %s\n", strerror((int)n));
return EPROTO;
}
diff --git a/modules/mpa/mpa.c b/modules/mpa/mpa.c
index 316afd1..d36e07d 100644
--- a/modules/mpa/mpa.c
+++ b/modules/mpa/mpa.c
@@ -107,7 +107,7 @@ static int module_init(void)
if (0 == conf_get_u32(conf, "mpa_bitrate", &value)) {
if (value<8000 || value>384000) {
- error("MPA bitrate between 8000 and "
+ warning("MPA bitrate between 8000 and "
"384000 are allowed.\n");
return -1;
}
@@ -118,7 +118,7 @@ static int module_init(void)
}
if (0 == conf_get_u32(conf, "mpa_layer", &value)) {
if (value<1 || value>4) {
- error("MPA layer 1, 2 or 3 are allowed.");
+ warning("MPA layer 1, 2 or 3 are allowed.");
return -1;
}
(void)re_snprintf(fmtp+strlen(fmtp),
@@ -135,7 +135,7 @@ static int module_init(void)
case 24000:
break;
default:
- error("MPA samplerates of 16, 22.05, 24, 32, "
+ warning("MPA samplerates of 16, 22.05, 24, 32, "
"44.1, and 48 kHz are allowed.\n");
return -1;
}
@@ -154,7 +154,7 @@ static int module_init(void)
&& strcmp(mode,"joint_stereo")
&& strcmp(mode,"single_channel")
&& strcmp(mode,"dual_channel")) {
- error("MPA mode: Permissible values are stereo, "
+ warning("MPA mode: Permissible values are stereo, "
"joint_stereo, single_channel, dual_channel.\n");
return -1;
}
@@ -172,7 +172,7 @@ static int module_init(void)
/* init decoder library */
res = mpg123_init();
if (res != MPG123_OK) {
- error("MPA libmpg123 init error %s\n",
+ warning("MPA libmpg123 init error %s\n",
mpg123_plain_strerror(res));
return -1;
}
diff --git a/modules/presence/subscriber.c b/modules/presence/subscriber.c
index 914f74d..11da6d4 100644
--- a/modules/presence/subscriber.c
+++ b/modules/presence/subscriber.c
@@ -280,6 +280,7 @@ static int presence_alloc(struct contact *contact)
return 0;
}
+
static void contact_handler(struct contact *contact,
bool removed, void *arg)
{
@@ -293,7 +294,7 @@ static void contact_handler(struct contact *contact,
0 == pl_strcasecmp(&val, "p2p")) {
if (!removed) {
if (presence_alloc(contact) != 0) {
- error("presence: presence_alloc failed\n");
+ warning("presence: presence_alloc failed\n");
return;
}
}
@@ -311,7 +312,7 @@ static void contact_handler(struct contact *contact,
mem_deref(pres);
}
else {
- error("presence: No contact to remove\n");
+ warning("presence: No contact to remove\n");
}
}
}