[Freeswitch-branches] [commit] r11696 - freeswitch/branches/gmaruzz/mod_skypiax
FreeSWITCH SVN
gmaruzz at freeswitch.org
Sun Feb 8 11:01:28 PST 2009
Author: gmaruzz
Date: Sun Feb 8 13:01:28 2009
New Revision: 11696
Log:
skypiax: skypiax_protocol.c indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Sun Feb 8 13:01:28 2009
@@ -23,7 +23,6 @@
#endif /* WIN32 */
/*************************************/
-
#if defined(WIN32) && !defined(__CYGWIN__)
int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany)
{
@@ -45,7 +44,6 @@
}
#endif /* WIN32 */
-
#if defined(WIN32) && !defined(__CYGWIN__)
int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany)
{
@@ -67,7 +65,6 @@
}
#endif /* WIN32 */
-
#if defined(WIN32) && !defined(__CYGWIN__)
int skypiax_close_socket(unsigned int fd)
{
@@ -254,7 +251,6 @@
return NULL;
}
-
void *skypiax_do_tcp_cli_thread_func(void *obj)
{
private_t *tech_pvt = obj;
@@ -338,12 +334,14 @@
#endif /* WIN32 */
if (rt > 0) {
- /* read from the pipe the audio frame we are supposed to send out */
- got = skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in, SAMPLES_PER_FRAME * sizeof(short));
- if (got != SAMPLES_PER_FRAME * sizeof(short)) {
- ERRORA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
- SAMPLES_PER_FRAME * sizeof(short));
- }
+ /* read from the pipe the audio frame we are supposed to send out */
+ got =
+ skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in,
+ SAMPLES_PER_FRAME * sizeof(short));
+ if (got != SAMPLES_PER_FRAME * sizeof(short)) {
+ ERRORA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
+ SAMPLES_PER_FRAME * sizeof(short));
+ }
if (got == SAMPLES_PER_FRAME * sizeof(short)) {
if (SAMPLERATE_SKYPIAX == 8000) {
@@ -356,7 +354,7 @@
cli_out[a] = cli_in[i];
a++;
}
- got = got * 2;
+ got = got * 2;
} else if (SAMPLERATE_SKYPIAX == 16000) {
/* we're NOT upsampling, cli_out will contain just ALL samples from cli_in */
for (i = 0; i < got / sizeof(short); i++) {
@@ -366,34 +364,35 @@
ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
}
- /* send the 16khz frame to the Skype client waiting for incoming audio */
+ /* send the 16khz frame to the Skype client waiting for incoming audio */
#ifdef WIN32
- len = send(fd, (char *) cli_out, got, 0);
+ len = send(fd, (char *) cli_out, got, 0);
#else /* WIN32 */
- len = send(fd, cli_out, got, 0);
-#endif /* WIN32 */
-
- if (len == -1) {
- break;
- } else if (len != got){
- ERRORA("len=%d\n", SKYPIAX_P_LOG, len);
- skypiax_sleep(1000);
- break;
- }
+ len = send(fd, cli_out, got, 0);
+#endif /* WIN32 */
- } else {
+ if (len == -1) {
+ break;
+ } else if (len != got) {
+ ERRORA("len=%d\n", SKYPIAX_P_LOG, len);
+ skypiax_sleep(1000);
+ break;
+ }
- ERRORA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got, SAMPLES_PER_FRAME * sizeof(short));
- skypiax_sleep(10000);
+ } else {
- }
+ ERRORA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
+ SAMPLES_PER_FRAME * sizeof(short));
+ skypiax_sleep(10000);
+
+ }
} else {
if (rt)
ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
skypiax_sleep(10000);
}
- }
+ }
DEBUGA_SKYPE("Skype outbound audio GONE\n", SKYPIAX_P_LOG);
skypiax_close_socket(fd);
break;
@@ -429,7 +428,7 @@
}
#endif /* WIN32 */
-/* the pipe is the audio fd for asterisk to poll on during a call */
+/* this pipe is the audio fd for asterisk to poll on during a call. FS do not use it */
tech_pvt->skypiax_sound_capt_fd = tech_pvt->audiopipe[0];
return 0;
@@ -437,7 +436,6 @@
int skypiax_skypeaudio_read(private_t * tech_pvt)
{
- //private_t *p;
unsigned int samples;
int rt;
#ifndef WIN32
@@ -458,7 +456,8 @@
#endif /* WIN32 */
if (rt > 0) {
samples = SAMPLES_PER_FRAME * sizeof(short);
- samples = skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, samples);
+ samples =
+ skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, samples);
//ERRORA("tech_pvt->audiopipe[0] = %d\n", SKYPIAX_P_LOG, tech_pvt->audiopipe[0]);
//ERRORA("tech_pvt->audiopipe[1] = %d\n", SKYPIAX_P_LOG, tech_pvt->audiopipe[1]);
@@ -1119,7 +1118,9 @@
if (rt > 0) {
if (tech_pvt->SkypiaxHandles.fdesc[0]) {
howmany = sizeof(read_from_pipe);
- howmany = skypiax_pipe_read(tech_pvt->SkypiaxHandles.fdesc[0], (short *)read_from_pipe, howmany);
+ howmany =
+ skypiax_pipe_read(tech_pvt->SkypiaxHandles.fdesc[0], (short *) read_from_pipe,
+ howmany);
a = 0;
for (i = 0; i < howmany; i++) {
More information about the Freeswitch-branches
mailing list