[Freeswitch-svn] [commit] r10313 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax

FreeSWITCH SVN gmaruzz at freeswitch.org
Mon Nov 10 05:41:00 PST 2008


Author: gmaruzz
Date: Mon Nov 10 08:41:00 2008
New Revision: 10313

Log:
skypiax: we will have to correctly build the FS frame, set the flags (TFLAG_VOICE, etc)

Modified:
   freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c

Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	(original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	Mon Nov 10 08:41:00 2008
@@ -676,6 +676,7 @@
 	//unsigned int elapsed;
 	switch_byte_t *data;
 
+
 	channel = switch_core_session_get_channel(session);
 	assert(channel != NULL);
 
@@ -684,20 +685,46 @@
 	tech_pvt->read_frame.flags = SFF_NONE;
 	*frame = NULL;
 
-	while (switch_test_flag(tech_pvt, TFLAG_IO)) {
 
+	while (switch_test_flag(tech_pvt, TFLAG_IO)) {
 		if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
 			switch_clear_flag(tech_pvt, TFLAG_BREAK);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL READ FRAME goto CNG\n");
 			goto cng;
 		}
 
 		if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL READ FRAME not IO\n");
 			return SWITCH_STATUS_FALSE;
 		}
 
+#if 0
+  if ((samples = read(p->audiopipe[0], buf, SAMPLES_PER_FRAME * sizeof(short))) != 320) {
+    DEBUGA_SOUND("read=====> NOT GOOD samples=%d expected=%d\n", SKYPIAX_P_LOG, samples,
+                 SAMPLES_PER_FRAME * sizeof(short));
+    usleep(100);
+    //do nothing
+  } else {
+    //DEBUGA_SOUND("read=====> GOOD samples=%d\n", SKYPIAX_P_LOG, samples);
+    /* A real frame */
+    f.frametype = AST_FRAME_VOICE;
+    f.subclass = AST_FORMAT_SLINEAR;
+    f.samples = SKYPIAX_FRAME_SIZE;
+    f.datalen = SKYPIAX_FRAME_SIZE * 2;
+    f.data = buf;
+    f.offset = AST_FRIENDLY_OFFSET;
+    f.src = skypiax_type;
+    f.mallocd = 0;
+  }
+#endif
+
+
+			//switch_set_flag_locked(tech_pvt, TFLAG_VOICE); //FIXME
+
 		if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) {
 			switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
 			if (!tech_pvt->read_frame.datalen) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL READ CONTINUE\n");
 				continue;
 			}
 			*frame = &tech_pvt->read_frame;
@@ -713,6 +740,7 @@
 	}
 
 
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL READ FALSE\n");
 	return SWITCH_STATUS_FALSE;
 
   cng:
@@ -734,6 +762,8 @@
 	int sent;
 	struct skypiax_config *p=NULL;
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL WRITE FRAME\n");
+
 	channel = switch_core_session_get_channel(session);
 	assert(channel != NULL);
 



More information about the Freeswitch-svn mailing list