diff --git a/build/sounds_upgradecode.txt b/build/sounds_upgradecode.txt index ec5ec47e48..1ba75c4b9c 100644 --- a/build/sounds_upgradecode.txt +++ b/build/sounds_upgradecode.txt @@ -2,7 +2,10 @@ music c0dcf85a-d07d-4c73-97ca-c327d9755830 85f85500-b86d-4f51-abf5-3cd63a2cc52d en-us-callie deb95334-fcd2-4b8a-91e7-a7828b99389d 249bfdc8-cb08-4ad5-9e38-06094e231d35 ef6db7d9-df8d-43e2-a3ec-16dd3fe1ac1b d515dc88-08df-4499-a6af-434cc5f68f86 en-us-allison 61179bb5-2289-4ae1-8a74-4e3d2821b691 2754130e-8896-4180-9227-a4ca2102c7c3 5b78a401-7244-438d-b83e-c944073842fd 13b50511-6f6d-43cf-a8b1-515c83708527 ru-RU-elena 9e0697a5-57b5-4f79-b95a-c85957f2a327 e52ebf36-ef86-41a5-8adf-1fcff6c42366 bfa6fdd6-fd24-4c9e-889d-88bcbbd173aa c088aedf-45ee-4cd5-8bfb-a64834affa9f +ru-RU-kirill a6eaa704-213c-41fe-9de6-d762e02d5a63 ab3ead40-330e-4a9b-836d-08a59b5b17a3 e8cbfbf9-f280-43fb-b0cd-3b5b35d21d57 30b7d223-d0ed-406e-b4bc-5e83afcfe3ce +ru-RU-vika a14d6d84-3d40-4b84-9183-5c5d79a50d80 98dda84e-5818-4c6d-9e5e-2f9bfa9fefb3 897e2415-1043-44df-963c-5e887e0132b0 e4e843ac-0ab7-4f9f-9b79-267e45c01554 en-ca-june 649e7650-8298-4eba-ad59-2e0c49c0f79d f3134354-4b8e-4838-a2b6-62d8ffc2e877 e84dbde6-272c-472b-ab67-307c4b4ca0d0 79fb31f3-1f2f-4f5c-983b-1fe98b56af11 +es-ar-mario 68968243-6083-43d1-b259-d5f6e52805dc 9c5ba2ef-4b98-465a-b520-b7a85f83cacf f9e18881-412d-433f-807e-538ff339e043 cd298723-2987-484c-86a5-9e5512f12881 fr-ca-june 5ad7d0be-5164-416a-a86c-8d04eed94612 ed777145-13bd-44b1-bdbb-475f90ddfcb0 d98b2cfb-2a16-49de-8bda-10aa20845c0a 5c8a40ea-f2fa-463a-8e80-fbb2be65d7b4 pt-BR-karina 967a03cd-0df7-42ff-a396-8fe03c2c2fa3 79e264fb-0515-442d-900e-b7b979957faa 8801315b-5f27-4088-8b66-44d1fc4b1584 5152ae5e-bf0e-4f86-abf4-ecc8f0887932 sv-se-jakob ee23c4fa-63c9-4ab5-a11c-ec9d124664b9 d2af540d-6544-45e0-8443-f3c39d983cbd f8130d60-6cce-4cac-a2d1-dd046691accd f404fbe3-13c7-4cff-96a0-14634b7f8543 diff --git a/build/sounds_version.txt b/build/sounds_version.txt index 4c4f290b82..b0b46ff4e2 100644 --- a/build/sounds_version.txt +++ b/build/sounds_version.txt @@ -1,7 +1,10 @@ -en-us-callie 1.0.51 -en-us-allison 1.0.0 +en-us-callie 1.0.52 +en-us-allison 1.0.1 ru-RU-elena 1.0.51 +ru-RU-kirill 1.0.0 +ru-RU-vika 1.0.0 en-ca-june 1.0.51 +es-ar-mario 1.0.0 fr-ca-june 1.0.51 pt-BR-karina 1.0.51 sv-se-jakob 1.0.50 diff --git a/configure.ac b/configure.ac index b0b9576c57..b9a8b45fd4 100644 --- a/configure.ac +++ b/configure.ac @@ -1247,6 +1247,7 @@ case $host in path_push_unique PKG_CONFIG_PATH /usr/local/opt/sqlite/lib/pkgconfig/ path_push_unique PKG_CONFIG_PATH /usr/local/opt/ldns/lib/pkgconfig/ path_push_unique PKG_CONFIG_PATH /usr/local/opt/portaudio/lib/pkgconfig/ + path_push_unique PKG_CONFIG_PATH /usr/local/opt/ffmpeg/lib/pkgconfig/ ;; esac @@ -2002,7 +2003,6 @@ AC_CONFIG_FILES([Makefile src/mod/xml_int/mod_xml_rpc/Makefile src/mod/xml_int/mod_xml_scgi/Makefile src/mod/applications/mod_av/Makefile - src/mod/applications/mod_av/test/Makefile src/mod/applications/mod_video_filter/Makefile src/include/switch_am_config.h build/getsounds.sh diff --git a/src/mod/applications/mod_av/Makefile.am b/src/mod/applications/mod_av/Makefile.am index cefcdcf113..675eb514b0 100644 --- a/src/mod/applications/mod_av/Makefile.am +++ b/src/mod/applications/mod_av/Makefile.am @@ -3,13 +3,24 @@ MODNAME=mod_av if HAVE_AVFORMAT +noinst_LTLIBRARIES = libavmod.la + +libavmod_la_SOURCES = mod_av.c avformat.c avcodec.c +libavmod_la_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(AVRESAMPLE_CFALGS) + mod_LTLIBRARIES = mod_av.la -mod_av_la_SOURCES = mod_av.c avformat.c avcodec.c -mod_av_la_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(AVRESAMPLE_CFALGS) -mod_av_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(AVRESAMPLE_LIBS) +mod_av_la_SOURCES = +mod_av_la_LIBADD = libavmod.la $(switch_builddir)/libfreeswitch.la $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(AVRESAMPLE_LIBS) mod_av_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -lz -SUBDIRS=. test + +bin_PROGRAMS = test/test_mod_av test/test_avformat +AM_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(AVRESAMPLE_CFALGS) +AM_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(AVRESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) +TESTS = $(bin_PROGRAMS) + +test_test_mod_av_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la +test_test_avformat_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la else install: error diff --git a/src/mod/applications/mod_av/test/Makefile.am b/src/mod/applications/mod_av/test/Makefile.am deleted file mode 100644 index b7111a2275..0000000000 --- a/src/mod/applications/mod_av/test/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -bin_PROGRAMS = test_mod_av test_avformat -AM_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(AVRESAMPLE_CFALGS) -AM_LDFLAGS = $(switch_builddir)/libfreeswitch.la $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(AVRESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) ../mod_av.la -TESTS = $(bin_PROGRAMS) diff --git a/src/mod/applications/mod_av/test/test_avformat.c b/src/mod/applications/mod_av/test/test_avformat.c index fed0264d34..de7150e3c9 100644 --- a/src/mod/applications/mod_av/test/test_avformat.c +++ b/src/mod/applications/mod_av/test/test_avformat.c @@ -52,6 +52,8 @@ FST_CORE_BEGIN("conf") switch_size_t len = SAMPLES; uint32_t flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO; int i = 0; + switch_image_t *ccimg; + switch_rgb_color_t color = {0}; fst_requires(img); @@ -68,10 +70,9 @@ FST_CORE_BEGIN("conf") status = switch_core_file_write_video(&fh, &frame); fst_check(status == SWITCH_STATUS_SUCCESS); - switch_image_t *ccimg = switch_img_read_png("./cluecon.png", SWITCH_IMG_FMT_ARGB); + ccimg = switch_img_read_png("./cluecon.png", SWITCH_IMG_FMT_ARGB); fst_requires(ccimg); - switch_rgb_color_t color = {0}; color.a = 255; for (i = 0; i < 30; i++) { @@ -108,6 +109,8 @@ FST_CORE_BEGIN("conf") switch_size_t len = SAMPLES; uint32_t flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO; int i = 0; + switch_rgb_color_t color = {0}; + switch_image_t *ccimg; fst_requires(img); @@ -124,10 +127,9 @@ FST_CORE_BEGIN("conf") status = switch_core_file_write_video(&fh, &frame); fst_check(status == SWITCH_STATUS_SUCCESS); - switch_image_t *ccimg = switch_img_read_png("./cluecon.png", SWITCH_IMG_FMT_ARGB); + ccimg = switch_img_read_png("./cluecon.png", SWITCH_IMG_FMT_ARGB); fst_requires(ccimg); - switch_rgb_color_t color = {0}; color.a = 255; for (i = 0; i < 30; i++) { @@ -156,9 +158,9 @@ FST_CORE_BEGIN("conf") FST_TEARDOWN_BEGIN() { - const char *err = NULL; - switch_sleep(1000000); - //fst_check(switch_loadable_module_unload_module(SWITCH_GLOBAL_dirs.mod_dir, (char *)"mod_av", SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS); + //const char *err = NULL; + switch_sleep(1000000); + //fst_check(switch_loadable_module_unload_module(SWITCH_GLOBAL_dirs.mod_dir, (char *)"mod_av", SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS); } FST_TEARDOWN_END() } diff --git a/src/mod/applications/mod_av/test/test_mod_av.c b/src/mod/applications/mod_av/test/test_mod_av.c index 51e594f344..18d3dfa225 100644 --- a/src/mod/applications/mod_av/test/test_mod_av.c +++ b/src/mod/applications/mod_av/test/test_mod_av.c @@ -50,9 +50,10 @@ static fctcl_init_t my_cl_options[] = { FST_CORE_BEGIN("conf") { + const char *loop_; fctcl_install(my_cl_options); - const char *loop_ = fctcl_val("--loop"); + loop_ = fctcl_val("--loop"); if (loop_) loop = atoi(loop_); FST_MODULE_BEGIN(mod_av, mod_av_test) @@ -67,7 +68,12 @@ FST_CORE_BEGIN("conf") { switch_status_t status; switch_codec_t codec = { 0 }; - switch_codec_settings_t codec_settings = { 0 }; + switch_codec_settings_t codec_settings = {{ 0 }}; + switch_image_t *img; + uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12]; + switch_frame_t frame = { 0 }; + int packets = 0; + switch_status_t encode_status; // switch_set_string(codec_settings.video.config_profile_name, "conference"); @@ -85,11 +91,9 @@ FST_CORE_BEGIN("conf") &codec_settings, fst_pool); fst_check(status == SWITCH_STATUS_SUCCESS); - switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1); + img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1); fst_requires(img); - uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12]; - switch_frame_t frame = { 0 }; frame.packet = buf; frame.packetlen = SWITCH_DEFAULT_VIDEO_SIZE + 12; @@ -101,9 +105,6 @@ FST_CORE_BEGIN("conf") frame.timestamp = 0; frame.img = img; - int packets = 0; - switch_status_t encode_status; - do { frame.datalen = SWITCH_DEFAULT_VIDEO_SIZE; encode_status = switch_core_codec_encode_video(&codec, &frame); diff --git a/src/mod/applications/mod_conference/conference_loop.c b/src/mod/applications/mod_conference/conference_loop.c index 78024f10de..49377312c6 100644 --- a/src/mod/applications/mod_conference/conference_loop.c +++ b/src/mod/applications/mod_conference/conference_loop.c @@ -939,10 +939,6 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob goto do_continue; } - if (!switch_channel_test_app_flag(channel, CF_AUDIO)) { - goto do_continue; - } - /* if the member can speak, compute the audio energy level and */ /* generate events when the level crosses the threshold */ if (((conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK) && !conference_utils_member_test_flag(member, MFLAG_HOLD)) || @@ -1232,7 +1228,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob if (datalen) { switch_size_t ok = 1; - + /* Write the audio into the input buffer */ switch_mutex_lock(member->audio_in_mutex); if (switch_buffer_inuse(member->audio_buffer) > flush_len) { diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 86be4911a8..5562272309 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -611,7 +611,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob for (omember = conference->members; omember; omember = omember->next) { switch_size_t ok = 1; - if (!conference_utils_member_test_flag(omember, MFLAG_RUNNING) || !switch_channel_test_flag(omember->channel, CF_AUDIO)) { + if (!conference_utils_member_test_flag(omember, MFLAG_RUNNING)) { continue; } @@ -667,14 +667,13 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob write_frame[x] = (int16_t) z; } - if (switch_channel_test_flag(omember->channel, CF_AUDIO)) { - switch_mutex_lock(omember->audio_out_mutex); - ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes); - switch_mutex_unlock(omember->audio_out_mutex); - if (!ok) { - switch_mutex_unlock(conference->mutex); - goto end; - } + switch_mutex_lock(omember->audio_out_mutex); + ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes); + switch_mutex_unlock(omember->audio_out_mutex); + + if (!ok) { + switch_mutex_unlock(conference->mutex); + goto end; } } } else { /* There is no source audio. Push silence into all of the buffers */ @@ -689,7 +688,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob for (omember = conference->members; omember; omember = omember->next) { switch_size_t ok = 1; - if (!conference_utils_member_test_flag(omember, MFLAG_RUNNING) || !switch_channel_test_flag(omember->channel, CF_AUDIO)) { + if (!conference_utils_member_test_flag(omember, MFLAG_RUNNING)) { continue; } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index c2900cf515..0da976608d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2183,7 +2183,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi break; case SWITCH_MESSAGE_INDICATE_RESPOND: { - printf("WHAT THE FUCKING HELL? %d\n", switch_channel_test_flag(tech_pvt->channel, CF_AWAITING_STREAM_CHANGE)); if (switch_channel_test_flag(tech_pvt->channel, CF_AWAITING_STREAM_CHANGE)) { switch_channel_clear_flag(tech_pvt->channel, CF_AWAITING_STREAM_CHANGE); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d1e32a096f..739a7d7078 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5389,9 +5389,9 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } else if (!strcasecmp(var, "NDLB-allow-bad-iananame")) { if (switch_true(val)) { - profile->mndlb |= SM_NDLB_ALLOW_BAD_IANANAME; + profile->ndlb |= SM_NDLB_ALLOW_BAD_IANANAME; } else { - profile->mndlb &= ~SM_NDLB_ALLOW_BAD_IANANAME; + profile->ndlb &= ~SM_NDLB_ALLOW_BAD_IANANAME; } } else if (!strcasecmp(var, "NDLB-expires-in-register-response")) { if (switch_true(val)) { diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c index 7a2e62c925..c1b792f490 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c @@ -519,8 +519,8 @@ switch_status_t create_acceptor() { char ipbuf[48]; const char *ip_addr; -#if ERLANG_MAJOR >= 10 - ei_init(); +#if (ERLANG_MAJOR == 10 && ERLANG_MINOR >= 3) || ERLANG_MAJOR >= 11 + ei_init(); #endif /* if the config has specified an erlang release compatibility then pass that along to the erlang interface */ diff --git a/src/mod/say/mod_say_ja/mod_say_ja.c b/src/mod/say/mod_say_ja/mod_say_ja.c index 72c7c38131..d8e0692fd0 100644 --- a/src/mod/say/mod_say_ja/mod_say_ja.c +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -367,7 +367,8 @@ static switch_status_t ja_say_time(switch_core_session_t *session, char *tosay, say_file("time/pm.wav"); } say_file("time/hour-%d.wav", tm.tm_hour); - if (tm.tm_min > 10) { + /* tm_min is always < 60 - this is just to silence gcc 8 warning */ + if (tm.tm_min > 10 && tm.tm_min < 60) { int temp; char tch[1+1]; mod_min = tm.tm_min % 10; diff --git a/src/switch_console.c b/src/switch_console.c index 876b77434e..ec891d44b4 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -150,7 +150,6 @@ SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_raw_write(switch_st SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, const char *fmt, ...) { va_list ap; - char *buf = handle->data; char *end = handle->end; int ret = 0; char *data = NULL; @@ -178,7 +177,6 @@ SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_write(switch_stream if ((new_data = realloc(handle->data, new_len))) { handle->data_size = handle->alloc_len = new_len; handle->data = new_data; - buf = handle->data; remaining = handle->data_size - handle->data_len; handle->end = (uint8_t *) (handle->data) + handle->data_len; end = handle->end; @@ -194,7 +192,7 @@ SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_write(switch_stream } else { ret = 0; switch_snprintf(end, remaining, "%s", data); - handle->data_len = strlen(buf); + handle->data_len += strlen(data); handle->end = (uint8_t *) (handle->data) + handle->data_len; } free(data); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 48861b1e3d..10df7fbc9e 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -11918,7 +11918,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) strncpy(q, p, 7); p += 7; q += 7; - strncpy(q, strchr(a_engine->adv_sdp_ip, ':') ? "6 " : "4 ", 2); + memcpy(q, strchr(a_engine->adv_sdp_ip, ':') ? "6 " : "4 ", 2); p +=2; q +=2; strncpy(q, a_engine->adv_sdp_ip, strlen(a_engine->adv_sdp_ip)); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 02e6897778..feb69d6b8e 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -3583,8 +3583,6 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_cache_db_create_schema(sql_manager.dbh, "create index complete10 on complete (a10,hostname)", NULL); switch_cache_db_create_schema(sql_manager.dbh, "create index complete11 on complete (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,hostname)", NULL); switch_cache_db_create_schema(sql_manager.dbh, "create index nat_map_port_proto on nat (port,proto,hostname)", NULL); - switch_cache_db_create_schema(sql_manager.dbh, "create index channels1 on channels(hostname)", NULL); - switch_cache_db_create_schema(sql_manager.dbh, "create index calls1 on calls(hostname)", NULL); switch_cache_db_create_schema(sql_manager.dbh, "create index chidx1 on channels (hostname)", NULL); switch_cache_db_create_schema(sql_manager.dbh, "create index uuindex on channels (uuid, hostname)", NULL); switch_cache_db_create_schema(sql_manager.dbh, "create index uuindex2 on channels (call_uuid)", NULL); diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 76f757ed82..d30299e169 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/build/modmake.rulesam -bin_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core +bin_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console AM_LDFLAGS = -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS) AM_LDFLAGS += $(FREESWITCH_LIBS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) AM_CFLAGS = $(SWITCH_AM_CPPFLAGS) diff --git a/tests/unit/switch_console.c b/tests/unit/switch_console.c new file mode 100644 index 0000000000..547b6f01ee --- /dev/null +++ b/tests/unit/switch_console.c @@ -0,0 +1,82 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2018, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Konstantin Molchanov + * + * + * switch_utils.c -- tests switch_utils + * + */ + +#include +#include +#include + +FST_MINCORE_BEGIN() + +FST_SUITE_BEGIN(SWITCH_STANDARD_STREAM) + +FST_SETUP_BEGIN() +{ +} +FST_SETUP_END() + +FST_TEARDOWN_BEGIN() +{ +} +FST_TEARDOWN_END() + +FST_TEST_BEGIN(benchmark) +{ + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); + + char expected_result[] = {'A', 0x00, 0x01, 0x02, 'B'}; + char raw_data[] = {0x00, 0x01, 0x02}; + + stream.write_function(&stream, "%s", "A"); + stream.raw_write_function(&stream, (uint8_t *) raw_data, sizeof(raw_data)); + stream.write_function(&stream, "B"); + + fst_requires(stream.data_len == sizeof(expected_result)); + fst_requires(memcmp(stream.data, expected_result, sizeof(expected_result)) == 0); + + switch_safe_free(stream.data); +} +FST_TEST_END() + +FST_SUITE_END() + +FST_MINCORE_END() + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: + */