Revision
16709
Author
gmaruzz
Date
2010-02-20 07:18:04 -0600 (Sat, 20 Feb 2010)

Log Message

skypiax: new audio threading works on windoz, little cleaning

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c (16708 => 16709)


--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c	2010-02-20 12:32:10 UTC (rev 16708)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c	2010-02-20 13:18:04 UTC (rev 16709)
@@ -538,7 +538,6 @@
 	tech_pvt->interface_state = SKYPIAX_STATE_HANGUP_REQUESTED;
 
 	if (strlen(tech_pvt->skype_call_id)) {
-		//switch_thread_cond_signal(tech_pvt->cond);
 		DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id);
 		sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id);
 		skypiax_signaling_write(tech_pvt, msg_to_skype);
@@ -549,13 +548,13 @@
 			if (tech_pvt->tcp_cli_thread) {
 				switch_thread_join(&status, tech_pvt->tcp_cli_thread);
 			}
-			if(status!=SWITCH_STATUS_SUCCESS)
-	ERRORA("%s cli_join HANGUP\n", SKYPIAX_P_LOG, tech_pvt->name);
+			//if(status!=SWITCH_STATUS_SUCCESS)
+	//ERRORA("%s cli_join HANGUP\n", SKYPIAX_P_LOG, tech_pvt->name);
 			if (tech_pvt->tcp_srv_thread) {
 				switch_thread_join(&status, tech_pvt->tcp_srv_thread);
 			}
-			if(status!=SWITCH_STATUS_SUCCESS)
-	ERRORA("%s srv_join HANGUP\n", SKYPIAX_P_LOG, tech_pvt->name);
+			//if(status!=SWITCH_STATUS_SUCCESS)
+	//ERRORA("%s srv_join HANGUP\n", SKYPIAX_P_LOG, tech_pvt->name);
 	DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPIAX_P_LOG, tech_pvt->name);
 	switch_mutex_lock(globals.mutex);
 	globals.calls--;
@@ -883,8 +882,8 @@
 	char digit_str[256];
 	short *frame_16_khz;
 	short frame_8_khz[160];	
-	int i;
-	int a;
+	unsigned int i;
+	unsigned int a;
 size_t bytes_read;
 
 
@@ -928,7 +927,7 @@
 
 
 	if (!bytes_read) {
-		ERRORA("skypiax_audio_read Silence\n", SKYPIAX_P_LOG);
+		DEBUGA_SKYPE("skypiax_audio_read Silence\n", SKYPIAX_P_LOG);
 		memset(tech_pvt->read_frame.data, 255, SAMPLES_PER_FRAME * sizeof(short));
 		tech_pvt->read_frame.datalen = SAMPLES_PER_FRAME * sizeof(short);
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (16708 => 16709)


--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	2010-02-20 12:32:10 UTC (rev 16708)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	2010-02-20 13:18:04 UTC (rev 16709)
@@ -39,7 +39,7 @@
 	unsigned short start_port = 6001;
 #endif //WIN32
 	int sockbufsize = 0;
-	unsigned int size = sizeof(int);
+	int size = sizeof(int);
 
 
 	memset(&my_addr, 0, sizeof(my_addr));
@@ -1305,7 +1305,7 @@
 	//short kill_cli_buff[SAMPLES_PER_FRAME];
 	//short totalbuf[SAMPLES_PER_FRAME];
 	int sockbufsize = 0;
-	unsigned int size = sizeof(int);
+	int size = sizeof(int);
 
 	s = skypiax_socket_create_and_bind(tech_pvt, &tech_pvt->tcp_srv_port);
 	if (s < 0) {
@@ -1390,7 +1390,7 @@
 						}
 
 						if (len == -1) {
-							ERRORA("len=%d, error: %s\n", SKYPIAX_P_LOG, len,  strerror(errno));
+							DEBUGA_SKYPE("len=%d, error: %s\n", SKYPIAX_P_LOG, len,  strerror(errno));
 							break;
 						}
 						if (len > 0) {
@@ -1398,16 +1398,16 @@
 							switch_buffer_write(tech_pvt->read_buffer, srv_in, len);
 							switch_mutex_unlock(tech_pvt->mutex_audio_srv);
 						} else if (len == 0) {
-							ERRORA("CLOSING, len=%d, expected 640\n", SKYPIAX_P_LOG, len);
+							DEBUGA_SKYPE("CLOSING, len=%d, expected 640\n", SKYPIAX_P_LOG, len);
 							break;
 						} else {
-							WARNINGA("len=%d, expected 640\n", SKYPIAX_P_LOG, len);
+							DEBUGA_SKYPE("len=%d, expected 640\n", SKYPIAX_P_LOG, len);
 						}
 
 					} else if(rt==0){
 						continue;
 					} else {
-						ERRORA("SRV rt=%d\n", SKYPIAX_P_LOG, rt);
+						DEBUGA_SKYPE("SRV rt=%d\n", SKYPIAX_P_LOG, rt);
 						break;
 					}
 
@@ -1415,7 +1415,7 @@
 
 				DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
 				tech_pvt->skype_callflow = CALLFLOW_INCOMING_HANGUP;
-				skypiax_sleep(20000);
+				//skypiax_sleep(20000);
 				skypiax_close_socket(fd);
 				break;
 			}
@@ -1449,7 +1449,7 @@
 	unsigned int sin_size;
 #endif /* WIN32 */
 	int sockbufsize = 0;
-	unsigned int size = sizeof(int);
+	int size = sizeof(int);
 
 	s = skypiax_socket_create_and_bind(tech_pvt, &tech_pvt->tcp_cli_port);
 	if (s < 0) {
@@ -1555,7 +1555,7 @@
 						if(!switch_buffer_inuse(tech_pvt->write_buffer)){
 							memset(cli_out, 255, sizeof(cli_out));
 							bytes_to_write = 320;
-							DEBUGA_SKYPE("Silence!\n", SKYPIAX_P_LOG);
+							//DEBUGA_SKYPE("Silence!\n", SKYPIAX_P_LOG);
 						}else {
 							switch_mutex_lock(tech_pvt->mutex_audio_cli);
 							bytes_to_write = switch_buffer_read(tech_pvt->write_buffer, cli_out, 320);
@@ -1564,26 +1564,26 @@
 
 						/* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */
 						if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
-							len = send(fd, cli_out, bytes_to_write, 0);
+							len = send(fd, (char *)cli_out, bytes_to_write, 0);
 							if (len == -1) {
-								ERRORA("len=%d, error: %s\n", SKYPIAX_P_LOG, len,  strerror(errno));
+								DEBUGA_SKYPE("len=%d, error: %s\n", SKYPIAX_P_LOG, len,  strerror(errno));
 								break;
 							}
 							if (len != bytes_to_write) {
-								WARNINGA("len=%d\n", SKYPIAX_P_LOG, len);
+								DEBUGA_SKYPE("len=%d\n", SKYPIAX_P_LOG, len);
 							}
 						}
 					} else if(rt==0){
 						continue;
 					} else {
-						ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
+						DEBUGA_SKYPE("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
 						break;
 					}
 
 				}
 				DEBUGA_SKYPE("Skype outbound audio GONE\n", SKYPIAX_P_LOG);
 				tech_pvt->skype_callflow = CALLFLOW_INCOMING_HANGUP;
-				skypiax_sleep(20000);
+				//skypiax_sleep(20000);
 				skypiax_close_socket(fd);
 				break;
 			}