summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-06-26 20:23:47 +0000
committerBenny Prijono <bennylp@teluu.com>2008-06-26 20:23:47 +0000
commitfa29e332b8c36497073e592ff45a65dad95dbba0 (patch)
tree58da69a6a896f82f4f98ec0dfd3e242ea48c685d
parent21192d78dc4ffd64243826b72000817cdbb80aed (diff)
Added option to disable stdout buffering in pjsua, and adjust the python tests
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2067 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/pjsua/pjsua_app.c12
-rw-r--r--pjsip-apps/src/test-pjsua/mod_call.py23
-rw-r--r--pjsip-apps/src/test-pjsua/run.py2
3 files changed, 24 insertions, 13 deletions
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c
index ca0caad2..1a8f50b1 100644
--- a/pjsip-apps/src/pjsua/pjsua_app.c
+++ b/pjsip-apps/src/pjsua/pjsua_app.c
@@ -464,6 +464,9 @@ static pj_status_t parse_args(int argc, char *argv[],
OPT_CAPTURE_DEV, OPT_PLAYBACK_DEV,
OPT_CAPTURE_LAT, OPT_PLAYBACK_LAT, OPT_NO_TONES,
OPT_STDOUT_REFRESH, OPT_STDOUT_REFRESH_TEXT,
+#ifdef _IONBF
+ OPT_STDOUT_NO_BUF,
+#endif
OPT_AUTO_UPDATE_NAT,OPT_USE_COMPACT_FORM,OPT_DIS_CODEC
};
struct pj_getopt_option long_options[] = {
@@ -554,6 +557,9 @@ static pj_status_t parse_args(int argc, char *argv[],
{ "playback-lat", 1, 0, OPT_PLAYBACK_LAT},
{ "stdout-refresh", 1, 0, OPT_STDOUT_REFRESH},
{ "stdout-refresh-text", 1, 0, OPT_STDOUT_REFRESH_TEXT},
+#ifdef _IONBF
+ { "stdout-no-buf", 0, 0, OPT_STDOUT_NO_BUF },
+#endif
{ "snd-auto-close", 1, 0, OPT_SND_AUTO_CLOSE},
{ "no-tones", 0, 0, OPT_NO_TONES},
{ NULL, 0, 0, 0}
@@ -1146,6 +1152,12 @@ static pj_status_t parse_args(int argc, char *argv[],
stdout_refresh_text = pj_optarg;
break;
+#ifdef _IONBF
+ case OPT_STDOUT_NO_BUF:
+ setvbuf(stdout, NULL, _IONBF, 0);
+ break;
+#endif
+
case OPT_CAPTURE_LAT:
cfg->capture_lat = atoi(pj_optarg);
break;
diff --git a/pjsip-apps/src/test-pjsua/mod_call.py b/pjsip-apps/src/test-pjsua/mod_call.py
index e123b3e7..49856689 100644
--- a/pjsip-apps/src/test-pjsua/mod_call.py
+++ b/pjsip-apps/src/test-pjsua/mod_call.py
@@ -36,7 +36,7 @@ def test_func(t, user_data):
caller.expect(const.STATE_CALLING)
# Callee waits for call and answers with 180/Ringing
- time.sleep(1)
+ time.sleep(0.2)
callee.expect(const.EVENT_INCOMING_CALL)
callee.send("a")
callee.send("180")
@@ -52,19 +52,19 @@ def test_func(t, user_data):
callee.send("200")
# Wait until call is connected in both endpoints
- time.sleep(1)
+ time.sleep(0.2)
caller.expect(const.STATE_CONFIRMED)
callee.expect(const.STATE_CONFIRMED)
# Synchronize stdout
caller.sync_stdout()
callee.sync_stdout()
- time.sleep(1)
+ time.sleep(0.1)
caller.sync_stdout()
callee.sync_stdout()
# Test that media is okay
- time.sleep(2)
+ time.sleep(0.3)
check_media(caller, callee)
check_media(callee, caller)
@@ -79,7 +79,7 @@ def test_func(t, user_data):
callee.sync_stdout()
# Release hold
- time.sleep(2)
+ time.sleep(0.5)
caller.send("v")
#caller.sync_stdout()
callee.expect(const.MEDIA_ACTIVE, title="waiting for media active after call hold")
@@ -108,7 +108,7 @@ def test_func(t, user_data):
callee.sync_stdout()
# Release hold
- time.sleep(2)
+ time.sleep(0.5)
callee.send("v")
#callee.sync_stdout()
caller.expect(const.MEDIA_ACTIVE, title="waiting for media active after call hold")
@@ -137,7 +137,7 @@ def test_func(t, user_data):
callee.sync_stdout()
# Test that media is okay
- time.sleep(2)
+ time.sleep(0.1)
check_media(caller, callee)
check_media(callee, caller)
@@ -152,7 +152,7 @@ def test_func(t, user_data):
callee.sync_stdout()
# Test that media is okay
- time.sleep(2)
+ time.sleep(0.1)
check_media(caller, callee)
check_media(callee, caller)
@@ -181,7 +181,7 @@ def test_func(t, user_data):
caller.sync_stdout()
# Test that media is still okay
- time.sleep(2)
+ time.sleep(0.1)
check_media(caller, callee)
check_media(callee, caller)
@@ -193,14 +193,13 @@ def test_func(t, user_data):
callee.sync_stdout()
# Test that media is still okay
- time.sleep(2)
+ time.sleep(0.1)
check_media(callee, caller)
check_media(caller, callee)
# Hangup call
- time.sleep(1)
+ time.sleep(0.1)
caller.send("h")
- caller.sync_stdout()
# Wait until calls are cleared in both endpoints
caller.expect(const.STATE_DISCONNECTED)
diff --git a/pjsip-apps/src/test-pjsua/run.py b/pjsip-apps/src/test-pjsua/run.py
index ad038882..e525bac9 100644
--- a/pjsip-apps/src/test-pjsua/run.py
+++ b/pjsip-apps/src/test-pjsua/run.py
@@ -59,7 +59,7 @@ class Expect:
self.name = inst_param.name
self.echo = inst_param.echo_enabled
self.trace_enabled = inst_param.trace_enabled
- fullcmd = G_EXE + " " + inst_param.arg + " --stdout-refresh=5 --stdout-refresh-text=" + const.STDOUT_REFRESH
+ fullcmd = G_EXE + " " + inst_param.arg + " --stdout-no-buf --stdout-refresh=5 --stdout-refresh-text=" + const.STDOUT_REFRESH
self.trace("Popen " + fullcmd)
self.proc = subprocess.Popen(fullcmd, shell=G_INUNIX, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=False)
def send(self, cmd):