From: <bc...@us...> - 2010-01-28 21:45:37
|
Revision: 1455 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1455&view=rev Author: bcholew Date: 2010-01-28 21:45:31 +0000 (Thu, 28 Jan 2010) Log Message: ----------- Fix a couple problems in stresstest - courtesy of Pete Grayson: - Initialize the running flag to true instead of false. Without this flag set, stresstest will fail to wait until the call is established to start sending audio and video frames. This is not generally fatal to the call, but it is bad protocol and a poor approximation of what a more robust iaxclient app would do. - Send "CONTROL:CAMERA_ENABLED" text message prior to sending video frames. This message is interpreted by app_conference. If it is not sent, app_conference will not switch the conference's video to the stresstest conference member. - Fix compiler warnings in file.c. Modified Paths: -------------- trunk/simpleclient/stresstest/file.c trunk/simpleclient/stresstest/stresstest.c Modified: trunk/simpleclient/stresstest/file.c =================================================================== --- trunk/simpleclient/stresstest/file.c 2008-11-10 20:21:46 UTC (rev 1454) +++ trunk/simpleclient/stresstest/file.c 2010-01-28 21:45:31 UTC (rev 1455) @@ -199,8 +199,8 @@ read_speex_cb(oggz, op, serialno, data); } else { - mylog("Got unknown ogg packet, serialno=%d, size=%d, " - "packetno=%d, granulepos=%d\n", + mylog("Got unknown ogg packet, serialno=%ld, size=%ld, " + "packetno=%lld, granulepos=%lld\n", serialno, op->bytes, op->packetno, op->granulepos); } Modified: trunk/simpleclient/stresstest/stresstest.c =================================================================== --- trunk/simpleclient/stresstest/stresstest.c 2008-11-10 20:21:46 UTC (rev 1454) +++ trunk/simpleclient/stresstest/stresstest.c 2010-01-28 21:45:31 UTC (rev 1455) @@ -69,8 +69,9 @@ static int fragsize = 1400; static int call_established = 0; -static int running = 0; +static int running = 1; +static int camera_enabled_sent = 0; static int send_video = 1; static int send_audio = 1; static int print_netstats = 0; @@ -221,27 +222,31 @@ return 0; } -void process_text_message(char *message) +void process_text_message(const char * message) { unsigned int prefs; + const char ctrl_str[] = "CONTROL:"; + const int ctrl_strlen = strlen(ctrl_str); - if ( strncmp(message, "CONTROL:", strlen("CONTROL:")) == 0 ) + if ( strncmp(message, ctrl_str, ctrl_strlen) == 0 ) { - message += strlen("CONTROL:"); + message += ctrl_strlen; if ( strcmp(message, "STOPVIDEO") == 0 ) { // Stop sending video prefs = iaxc_get_video_prefs(); prefs = prefs | IAXC_VIDEO_PREF_SEND_DISABLE ; iaxc_set_video_prefs(prefs); - } else if ( strcmp(message, "STARTVIDEO") == 0 ) + } + else if ( strcmp(message, "STARTVIDEO") == 0 ) { // Start sending video prefs = iaxc_get_video_prefs(); prefs = prefs & ~IAXC_VIDEO_PREF_SEND_DISABLE ; iaxc_set_video_prefs(prefs); } - } else + } + else mylog("Text message received: %s\n", message); } @@ -534,8 +539,7 @@ // Wait for the call to be established; while ( !call_established && running ) { - struct timeval now; - now = get_now(); + struct timeval now = get_now(); if ( connect_timeout_ms > 0 && msecdiff(&start_time, &now) > connect_timeout_ms ) { @@ -546,7 +550,6 @@ iaxc_millisleep(5); } - running = 1; while ( running ) { struct timeval now = get_now(); @@ -571,7 +574,15 @@ if ( !loop && video_is_eos() ) break; if ( send_video && op != NULL && op->bytes > 0 ) + { + if ( !camera_enabled_sent ) + { + /* Let app_conference know that we can send video */ + iaxc_send_text("CONTROL:CAMERA_ENABLED"); + camera_enabled_sent = 1; + } iaxc_push_video(op->packet, op->bytes, 1); + } } // Tight spinloops are bad, mmmkay? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |