]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@104 d0543943-73ff-0310...
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 10 Dec 2005 01:14:49 +0000 (01:14 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 10 Dec 2005 01:14:49 +0000 (01:14 +0000)
src/mod/mod_portaudio/mod_portaudio.c
src/switch_core.c

index d161aed3f079f317aaaef55e299f1c6427bffe65..3520ec1eca95c5b9397d1f13c1c156eb4b803d95 100644 (file)
@@ -42,8 +42,8 @@ static const char modname[] = "mod_portaudio";
 static switch_memory_pool *module_pool;
 static int running = 1;
 
-#define SAMPLE_TYPE  paInt16\r
-typedef short SAMPLE;\r
+#define SAMPLE_TYPE  paInt16
+typedef short SAMPLE;
 
 typedef enum {
        TFLAG_IO = (1 << 0),
@@ -80,9 +80,9 @@ struct private_object {
        unsigned char databuf[1024];
        switch_core_session *session;
        switch_caller_profile *caller_profile;  
-       char call_id[50];\r
-       PaError err;\r
-    PABLIO_Stream *audio_in;\r
+       char call_id[50];
+       PaError err;
+    PABLIO_Stream *audio_in;
     PABLIO_Stream *audio_out;
        int indev;
        int outdev;
@@ -189,8 +189,8 @@ static switch_status channel_on_hangup(switch_core_session *session)
        switch_core_codec_destroy(&tech_pvt->read_codec);
        switch_core_codec_destroy(&tech_pvt->write_codec);
 
-       CloseAudioStream(tech_pvt->audio_in);\r
-       CloseAudioStream(tech_pvt->audio_out);\r
+       CloseAudioStream(tech_pvt->audio_in);
+       CloseAudioStream(tech_pvt->audio_out);
 
        switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
 
@@ -328,13 +328,13 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
 
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
-\r
-       if      ((t = ReadAudioStream(tech_pvt->audio_in, tech_pvt->read_frame.data, tech_pvt->read_codec.implementation->samples_per_frame))) {\r
-               tech_pvt->read_frame.datalen = t * 2;\r
-               tech_pvt->read_frame.samples = t;\r
-               *frame = &tech_pvt->read_frame;\r
-               return SWITCH_STATUS_SUCCESS;\r
-       }\r
+
+       if      ((t = ReadAudioStream(tech_pvt->audio_in, tech_pvt->read_frame.data, tech_pvt->read_codec.implementation->samples_per_frame))) {
+               tech_pvt->read_frame.datalen = t * 2;
+               tech_pvt->read_frame.samples = t;
+               *frame = &tech_pvt->read_frame;
+               return SWITCH_STATUS_SUCCESS;
+       }
 
 
        return SWITCH_STATUS_FALSE;
index 2dbc93f995cd45cc9f5252dd3a1ce28a2303e920..a4197a0b6724cbc16d675f4be98f48f285f7e1d2 100644 (file)
@@ -178,10 +178,13 @@ SWITCH_DECLARE(switch_status) switch_core_codec_init(switch_codec *codec, char *
        }
 
        if (implementation) {
+               switch_status status;
                codec->codec_interface = codec_interface;
                codec->implementation = implementation;
                codec->flags = flags;
-               switch_core_new_memory_pool(&codec->memory_pool);
+               if ((status = switch_core_new_memory_pool(&codec->memory_pool)) != SWITCH_STATUS_SUCCESS) {
+                       return status;
+               }
                implementation->init(codec, flags, codec_settings);
 
                return SWITCH_STATUS_SUCCESS;
@@ -258,7 +261,7 @@ SWITCH_DECLARE(switch_status) switch_core_codec_destroy(switch_codec *codec)
 SWITCH_DECLARE(switch_status) switch_core_timer_init(switch_timer *timer, char *timer_name, int interval, int samples)
 {
        switch_timer_interface *timer_interface;
-
+       switch_status status;
        memset(timer, 0, sizeof(*timer));
        if (!(timer_interface = loadable_module_get_timer_interface(timer_name))) {
                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "invalid timer %s!\n", timer_name);
@@ -269,7 +272,9 @@ SWITCH_DECLARE(switch_status) switch_core_timer_init(switch_timer *timer, char *
        timer->samples = samples;
        timer->samplecount = 0;
        timer->timer_interface = timer_interface;
-       switch_core_new_memory_pool(&timer->memory_pool);
+       if ((status = switch_core_new_memory_pool(&timer->memory_pool)) != SWITCH_STATUS_SUCCESS) {
+               return status;
+       }
 
        timer->timer_interface->timer_init(timer);
        return SWITCH_STATUS_SUCCESS;