From 1426e844c512d9e47751db123b3695e839282647 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 2 Oct 2008 21:13:43 +0000 Subject: [PATCH] remind me not to add ppls patches w/o reading them git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9805 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../mod_local_stream/mod_local_stream.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index ca567cda94..81e8978419 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -555,6 +555,7 @@ SWITCH_STANDARD_API(start_local_stream_function) int argc = 0; char *cf = "local_stream.conf"; switch_xml_t cfg, xml, directory, param; + int tmp; if (switch_strlen_zero(cmd)) { goto usage; @@ -569,12 +570,23 @@ SWITCH_STANDARD_API(start_local_stream_function) } local_stream_name = argv[0]; - path = argv[1] ? argv[1] : NULL; - rate = argv[2] ? atoi(argv[2]) : 8000; + + if (argv[1]) { + path = strdup(argv[1]); + } + + if (argv[2]) { + tmp = atoi(argv[2]); + if (tmp == 8000 || tmp == 16000 || tmp == 32000) { + rate = tmp; + } + } + shuffle = argv[3] ? switch_true(argv[3]) : 1; prebuf = argv[4] ? atoi(argv[4]) : DEFAULT_PREBUFFER_SIZE; channels = argv[5] ? (uint8_t)atoi(argv[5]) : 1; interval = argv[6] ? atoi(argv[6]) : 20; + if (!SWITCH_ACCEPTABLE_INTERVAL(interval)){ interval = 20; } @@ -635,6 +647,10 @@ SWITCH_STANDARD_API(start_local_stream_function) } } + + if (path) { + path = strdup(path); + } switch_xml_free(xml); } @@ -687,6 +703,7 @@ SWITCH_STANDARD_API(start_local_stream_function) done: + switch_safe_free(path); switch_safe_free(timer_name); switch_safe_free(mycmd); return SWITCH_STATUS_SUCCESS;