[Freeswitch-svn] [commit] r11043 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax
FreeSWITCH SVN
gmaruzz at freeswitch.org
Thu Jan 1 09:14:54 PST 2009
Author: gmaruzz
Date: Thu Jan 1 12:14:54 2009
New Revision: 11043
Log:
skypiax: looping on recv, will not compile on win, needs to be finished
Modified:
freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Thu Jan 1 12:14:54 2009
@@ -96,6 +96,7 @@
int rt;
fd_set fs;
struct timeval to;
+ int received = 0;
if (!running)
break;
@@ -108,13 +109,25 @@
to.tv_sec = 0;
rt = select(fdselect + 1, &fs, NULL, NULL, &to);
- //rt=0;
+ //rt=1;
if (rt > 0) {
#ifdef WIN32
len = recv(fd, (char *) srv_in, 320, 0); //seems that Skype only sends 320 bytes at time
#else /* WIN32 */
- len = recv(fd, (char *) srv_in, 320, 0); //seems that Skype only sends 320 bytes at time
+ while(received < SAMPLES_PER_FRAME * sizeof(short)){
+ len = recv(fd, srv_in + (received / sizeof(short)), (SAMPLES_PER_FRAME * sizeof(short)) - received, 0); //seems that Skype only sends 320 bytes at time
+ received += len;
+ if(len == 0)
+ break;
+ }
+ if(len)
+ len = received;
+
+
+
+
+ //len = recv(fd, srv_in, SAMPLES_PER_FRAME * sizeof(short), 0); //seems that Skype only sends 320 bytes at time
#endif /* WIN32 */
if ((SAMPLERATE_SKYPIAX - 8000) == 0) {
@@ -171,20 +184,20 @@
/****************************************************************/
if (len > 0) {
if (len == SAMPLES_PER_FRAME * sizeof(short)) {
- unsigned int howmany;
- howmany = len;
+ //unsigned int howmany;
+ //howmany = len;
- WARNINGA("SRV recv %d\n", SKYPIAX_P_LOG, len);
+ //WARNINGA("SRV recv %d\n", SKYPIAX_P_LOG, len);
#ifdef WIN32
switch_file_write(p->audiopipe[1], srv_in, &howmany);
#else /* WIN32 */
- howmany = write(p->audiopipe[1], srv_in, howmany);
+ len = write(p->audiopipe[1], srv_in, len);
#endif /* WIN32 */
- p->audiobuf_is_loaded = 0;
- WARNINGA("SRV PIPE WRITE=====> req=%lu recv=%d to sent=%d sent=%u\n",
- SKYPIAX_P_LOG, sizeof(short) * SAMPLES_PER_FRAME, len, len,
- howmany);
+ //p->audiobuf_is_loaded = 0;
+ //WARNINGA("SRV PIPE WRITE=====> req=%lu recv=%d to sent=%d sent=%u\n",
+ //SKYPIAX_P_LOG, sizeof(short) * SAMPLES_PER_FRAME, len, len,
+ //howmany);
} else if (len == SAMPLES_PER_FRAME * sizeof(short) / 2) {
#if 1
More information about the Freeswitch-svn
mailing list